[Papervision3D] Quaternion rotation
Jim Armstrong
algorithmist at algorithmist.net
Wed Mar 14 11:47:38 EST 2007
Joe McKeown wrote:
> Pardon me if this has already been addressed but I have yet to find an
> answer specific to PV3D.
>
> I'm trying to allow user interaction with a mouse to rotate a 3D object.
> I'm limiting rotation to 2 axes: X & Y. Euler rotations have the ugly
> reality of gimbal lock so I'm exploring the use of Quaternion math to
> handle the rotations. There's plenty of info about the algorithms and
> even some Actionscript implementations (e.g., Sandy's QuaternionMath
> class) but I can't seem to get anything to work. Generally, I can
> follow the concepts and math but without a specific example/solution for
> this problem I'm a bit lost. My experimenting has proven frustrating
> and I'm not sure where I'm going wrong.
>
> Does anyone have some input and/or direction as to translating 2D mouse
> coordinates to 3D rotation of an object?
>
If you're limiting rotation to two axes, by controlling the order, you
should not lock.
For example, if rotating along X and Y, apply Euler angles in the order
X, Z, Y. There was a good gamedev.net article on this topic, but the
URL escapes me.
Quaternions may be overkill for what you want, but I think there was an
example implementation in the Flash MX 2004 Magic book,
http://www.amazon.com/Macromedia-Flash-MX-2004-Magic/dp/0735713774
complete with code.
good luck!
- jim
**
**
--
Jim Armstrong::Mathematician::Algorithmist::Programmer
Singularity::www.algorithmist.net
More information about the Papervision3D
mailing list