x


Is it possible to compare Quaternions if the axes are the same?

I have a EulerAngle of Vector3(0,20,0) that represents a limit on a bone rotation.

I want to compare this limit with the actual rotation of a bone. Is there a way to convert Vector3(0,20,0) into a Quaternion with the same axis as the bone Y axis and then compare the angles?

If so how would I do that for the X and Z axis?

Thanks, Dan

more ▼

asked Mar 09 '12 at 05:26 PM

dansav gravatar image

dansav
392 105 137 158

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

1 answer: sort voted first

You mean http://unity3d.com/support/documentation/ScriptReference/Quaternion-eulerAngles.html ?

or

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

or

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

Sounds like you maybe want to compare the localRotation, or localEulerAngles of the child-bone to that of the parent bone yes?

You could also look into using a combination of http://unity3d.com/support/documentation/ScriptReference/Transform.TransformDirection.html and http://unity3d.com/support/documentation/ScriptReference/Transform.InverseTransformDirection.html to transform both bones to world space then back into the local space of the parent bone ?

more ▼

answered Mar 09 '12 at 09:14 PM

DaveA gravatar image

DaveA
26.8k 153 171 257

(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:

x459
x137
x50

asked: Mar 09 '12 at 05:26 PM

Seen: 743 times

Last Updated: Mar 09 '12 at 09:14 PM