A weird thing happen to my code, I don’t know why I worked like this, but it did.
My code is like this:
// Getting joint orientation data from kinect
// and construct it with Unity Quaternion
Kinect.Vector4 targetRotaV4 = body.JointOrientations[jt].Orientation;
Quaternion targetRotaQ = new Quaternion(targetRotaV4.X, targetRotaV4.Y, targetRotaV4.Z, targetRotaV4.W);
Debug.Log("target rotation: " + targetRotaQ); // it did print something
// Rotate the gameobject from its local rotation
// to the rotation I got from kinect
jointObj.localRotation = Quaternion.RotateTowards(jointObj.localRotation, targetRotaQ, 45.0f);
Debug.Log("Joint Object rotation: " + jointObj.localRotation);
// It did print value, too, not just (0, 0, 0, 0),
// but in the game, the gameobject didn't rotate, and the rotation didn't change in properties which kept 0
// But!! When I ran the following code, it rotated! Everything looked good.
/*
Quaternion testRote = new Quaternion(0.1f, 0.1f, 0.1f, 0.1f);
jointObj.localRotation = Quaternion.RotateTowards(jointObj.localRotation, testRote, 15);
Debug.Log("Joint local rotation" + jointObj.localRotation);
*/
So my question is, why! Why the rotation couldn’t work with my JointOrientation data from kinect which I did get the data because I print the value and it was not null or 0.
Plz help me out!