- Home /
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?
Answer by flaviusxvii · Mar 22, 2011 at 07:38 PM
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'.
Your answer
Follow this Question
Related Questions
Function similar to Quaternion.Angle for Scale or Position? 1 Answer
How do I rotate Z axis based off mouse click and drag? 2 Answers
Precise rotation based on joystick axis input for twin-stick controls 3 Answers
Set rotation based on 1,1,1 style vector? How to convert vector3 to quaternion? 1 Answer
Rotation from AngleAxis() ToAngleAxis() flips back and forth 1 Answer