public override NUISkeleton Filter(NUISkeleton input) { NUISkeleton output = input.Clone(); Vector3 spineBasePosition = output.Joints[NUIJointType.SpineBase].Position; foreach (var joint in output.Joints) { joint.Value.Position -= spineBasePosition; joint.Value.Position = Quaternion.AngleAxis(tilt, Vector3.right) * joint.Value.Position; joint.Value.Position += spineBasePosition; } return(output); }
public override NUISkeleton Filter(NUISkeleton input) { NUISkeleton output = input.Clone(); swapJoints(output, NUIJointType.HipLeft, NUIJointType.HipRight); swapJoints(output, NUIJointType.KneeLeft, NUIJointType.KneeRight); swapJoints(output, NUIJointType.AnkleLeft, NUIJointType.AnkleRight); swapJoints(output, NUIJointType.FootLeft, NUIJointType.FootRight); swapJoints(output, NUIJointType.ShoulderLeft, NUIJointType.ShoulderRight); swapJoints(output, NUIJointType.ElbowLeft, NUIJointType.ElbowRight); swapJoints(output, NUIJointType.WristLeft, NUIJointType.WristRight); swapJoints(output, NUIJointType.HandLeft, NUIJointType.HandRight); foreach (NUIJointType jointType in output.Joints.Keys) { output.Joints[jointType].Position = new Vector3(-output.Joints[jointType].Position.x, output.Joints[jointType].Position.y, output.Joints[jointType].Position.z); } return(output); }