Convert vector3 to quaternion

What I'm really looking for is to get from vector3 to euler angles.

I was thinking of converting a vector3 to a quaternion, and then using the eulerAngles method in the quaternion.

I want to be able to tell how many degrees away from Up the iphone's accelerometer is along a single axis.


more ▼

asked Apr 10 '10 at 10:32 PM

Peter B-B gravatar image

Peter B-B
251 14 16 21

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

1 answer: sort voted first

I think you want to use Quaternion.LookRotation() to create a rotation facing that Vector then measure the angle of the new quaternion.

more ▼

answered Apr 10 '10 at 11:48 PM

Peter G gravatar image

Peter G
17.2k 22 50 149

I could have sworn I tried that... Thanks!

Apr 11 '10 at 12:32 AM Peter B-B
(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



Answers and Comments



asked: Apr 10 '10 at 10:32 PM

Seen: 15487 times

Last Updated: Apr 10 '10 at 10:32 PM