/// <summary> /// Blend between two hand poses. /// </summary> public void InterpolateOffsets(ArticulatedHandPose poseA, ArticulatedHandPose poseB, float value) { for (int i = 0; i < jointCount; i++) { var p = Vector3.Lerp(poseA.localJointPoses[i].Position, poseB.localJointPoses[i].Position, value); var r = Quaternion.Slerp(poseA.localJointPoses[i].Rotation, poseB.localJointPoses[i].Rotation, value); localJointPoses[i] = new MixedRealityPose(p, r); } }
public MixedRealityPose GetLocalJointPose(TrackedHandJoint joint, Handedness handedness) { MixedRealityPose pose = localJointPoses[(int)joint]; // Pose offset are for right hand, mirror on X axis if left hand is needed if (handedness == Handedness.Left) { pose = new MixedRealityPose( new Vector3(-pose.Position.x, pose.Position.y, pose.Position.z), new Quaternion(pose.Rotation.x, -pose.Rotation.y, -pose.Rotation.z, pose.Rotation.w)); } return(pose); }
/// <summary> /// Compute world space poses from camera-space joint data. /// </summary> /// <param name="handedness">Handedness of the resulting pose</param> /// <param name="rotation">Rotational offset of the resulting pose</param> /// <param name="position">Translational offset of the resulting pose</param> /// <param name="jointsOut">Output array of joint poses</param> public void ComputeJointPoses( Handedness handedness, Quaternion rotation, Vector3 position, MixedRealityPose[] jointsOut) { for (int i = 0; i < JointCount; i++) { // Initialize from local offsets MixedRealityPose pose = GetLocalJointPose(Joints[i], handedness); Vector3 p = pose.Position; Quaternion r = pose.Rotation; // Apply external transform p = position + rotation * p; r = rotation * r; jointsOut[i] = new MixedRealityPose(p, r); } }
public ArticulatedHandPoseItem(TrackedHandJoint joint, MixedRealityPose pose) { this.joint = jointNames[(int)joint]; this.pose = pose; }
public bool Equals(MixedRealityPose other) { return(Position == other.Position && Rotation.Equals(other.Rotation)); }