public void SetCurrentPoser(HVRHandPoser poser, bool poseHand = true) { BlendedSecondarys.Clear(); TargetSecondarys.Clear(); _poseHand = poseHand; if (!PosePosAndRot) { _poseHand = false; } CurrentPoser = poser; if (poser == null) { return; } if (poser.PrimaryPose == null) { return; } BlendedPrimary = poser.PrimaryPose.Pose.GetPose(Hand.IsLeft).DeepCopy(); TargetPrimary = poser.PrimaryPose.Pose.GetPose(Hand.IsLeft).DeepCopy(); CurrentPrimary = poser.PrimaryPose.Pose.GetPose(Hand.IsLeft); for (var i = 0; i < poser.Blends.Count; i++) { var blend = poser.Blends[i]; if (blend.Pose) { BlendedSecondarys.Add(blend.Pose.GetPose(Hand.IsLeft).DeepCopy()); TargetSecondarys.Add(blend.Pose.GetPose(Hand.IsLeft).DeepCopy()); } } //if (poser.PrimaryPose.Type == BlendType.Immediate) //{ // Hand.Pose(poser.PrimaryPose.Pose.GetPose(Hand.Side), _poseHand); //} }
void Start() { HandPoser = GetComponent <HVRHandPoser>(); LeftPoseOffset = Quaternion.identity; RightPoseOffset = Quaternion.identity; JointOffset = Quaternion.Euler(jointOffset); if (HandPoser) { var grabbable = transform.parent?.parent; if (HandPoser && HandPoser.PrimaryPose != null && HandPoser.PrimaryPose.Pose && HandPoser.PrimaryPose.Pose.RightHand != null) { RightPoseOffset = Quaternion.Euler(HandPoser.PrimaryPose.Pose.RightHand.Rotation.eulerAngles); RightPosePositionOffset = HandPoser.PrimaryPose.Pose.RightHand.Position; } else if (RightHand) { Debug.LogWarning($"Right Hand pose missing! {grabbable?.name}.{this.name}"); } if (HandPoser && HandPoser.PrimaryPose != null && HandPoser.PrimaryPose.Pose && HandPoser.PrimaryPose.Pose.LeftHand != null && LeftHand) { LeftPoseOffset = Quaternion.Euler(HandPoser.PrimaryPose.Pose.LeftHand.Rotation.eulerAngles); LeftPosePositionOffset = HandPoser.PrimaryPose.Pose.LeftHand.Position; } else if (LeftHand) { Debug.LogWarning($"Left Hand pose missing! {grabbable?.name}.{this.name}"); } } if (IsLineGrab) { Line = LineEnd.localPosition - LineStart.localPosition; LineMid = (LineEnd.localPosition + LineStart.localPosition) / 2f; } }
void Start() { _fingerCurls = new float[5]; if (!PhysicsPoser) { PhysicsPoser = GetComponent <HVRPhysicsPoser>(); } if (!DefaultPoser) { DefaultPoser = GetComponent <HVRHandPoser>(); } if (!Hand) { Hand = GetComponent <HVRPosableHand>(); } DefaultPrimary = DefaultPoser.PrimaryPose.Pose.GetPose(Hand.IsLeft).DeepCopy(); ResetToDefault(); }