[Papervision3D] How to apply quaternions to a 3DObject
Andy Zupko
azupko at zupko.info
Sun Jul 6 23:53:24 PDT 2008
To use quaternions you simply need to multiply them back into your
objects transformation matrix. Something like this:
var rotation:Quaternion = Quaternion.createFromAxisAngle(rotAxis.x,
rotAxis.y, rotAxis.z, radians);
rotation.normalize();
do3d.transform.calculateMultiply3x3(rotation.toMatrix(),
do3d.transform);
createFromAxisAngle simply handles the sin/cos math for you, but you
can manually set your xyzw in the constructor as well.
You only need to do a 3x3 transform since you aren't using them for
translation (if you need help with that just ask - I have been having
a serious love affair with quaternions as of late).
You can see how to use it more fully at http://blog.zupko.info/?
p=143. Check the rollMe function in the source.
hope that helps
-andy
On Jul 7, 2008, at 2:00 AM, AngelicD wrote:
>
> Hi, basically i just need to rotate a 3d object such as a Plane,
> using a
> quaternion, that is i have the x,y,z,w values and i need to apply it
> to the
> 3d object.
>
> Don't seem to be able to figure out how to apply it directly to the
> object,
> I can do rotationX, rotationY, rotationZ fine (pitch, yaw, roll) but
> not
> directly through quaternions.
>
> Please Help,
>
> Thanks
>
> --
> View this message in context: http://www.nabble.com/How-to-apply-quaternions-to-a-3DObject-tp18310482p18310482.html
> Sent from the Papervision3D mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20080707/b3b553a9/attachment-0001.html
More information about the Papervision3D
mailing list