x


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?

more ▼

asked Mar 22 '11 at 07:23 PM

Simon 9 gravatar image

Simon 9
42 10 10 14

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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;
more ▼

answered Mar 22 '11 at 07:38 PM

flaviusxvii gravatar image

flaviusxvii
3k 13 19 43

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

Mar 22 '11 at 07:56 PM Jesse Anders

Awesome. I'm still learning too.

Mar 22 '11 at 08:06 PM flaviusxvii
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2166
x478
x440

asked: Mar 22 '11 at 07:23 PM

Seen: 1812 times

Last Updated: Mar 22 '11 at 07:23 PM