public Quaternion ConvertRawKinectRotation(OpenNI.SkeletonJointOrientation rotation) { Vector3 up = new Vector3(rotation.Y1, rotation.Y2, rotation.Y3); Vector3 forward = new Vector3(rotation.Z1, rotation.Z2, rotation.Z3); if (up == Vector3.zero || forward == Vector3.zero) { return(Quaternion.identity); } Quaternion newRotation = Quaternion.LookRotation(forward, up); newRotation.x = -newRotation.x; newRotation.y = -newRotation.y; return(newRotation); }
public Quaternion ConvertKinectRotation(OpenNI.SkeletonJointOrientation rotation) { Vector3 up = new Vector3(rotation.Y1, rotation.Y2, rotation.Y3); Vector3 forward = new Vector3(rotation.Z1, rotation.Z2, rotation.Z3); if (up == Vector3.zero || forward == Vector3.zero) { return(Quaternion.identity); } Quaternion newRotation = Quaternion.LookRotation(forward, up); newRotation.x = -newRotation.x; newRotation.y = -newRotation.y; newRotation = Quaternion.Euler(0, yawOffset, 0) * newRotation; //if (applyKinectToRUIS) result *= kinectYaw; return(newRotation); }