Setting Rotation based on 4 Quaternion Values

I have quaternion values imported from motion capture software. I would like to apply these rotation values to the in-game object to make the rotation match the mocap data.

Is there a function to set the rotation of an object that takes 4 quaternion values as input?

1 Answer

1

Make the quaternion with your x,y,z,w values

quaternion = Quaterion(x, y, z, w);

http://unity3d.com/support/documentation/ScriptReference/Quaternion.Quaternion.html

And then set

transform.eulerAngles = quaternion.eulerAngles;

Rather than 'transform.eulerAngles = quaternion.eulerAngles', you can just write 'transform.rotation = quaternion'.

Awesome. I'm still learning too.