[ODE] Rotation about two axes
Martin C. Martin
martin at metahuman.org
Fri Aug 8 14:17:01 2003
Hey Josh,
If the first rotation is 90 degrees, does the second cause the cylinder to
rotate about its own axis? I assume that's not the effect you want.
Either way, you could try using dRFromEulerAngles(). You'd have to set
one of them to a constant (zero or 90 degrees or something), not sure
which one though.
Joshua Bongard wrote:
>
> Hi,
> I've been trying to automate a way of rotating a cylinder about the
> horizontal and vertical axis. The user supplies two parameters,
> rotation[0] and rotation[1], which are these two rotations. The
> orientation of the cylinder is then calculated as follows:
>
> dMatrix3 Rx, Ry, Ryx;
>
> dRFromAxisAndAngle(Rx,1.0,0.0,0.0,rotation[0]);
> dRFromAxisAndAngle(Ry,0.0,1.0,0.0,rotation[1]);
>
> dMULTIPLY0_333(Ryx,Ry,Rx);
>
> dBodySetRotation(body,Ryx);
>
> The orientation is always _almost_ right, but is always off by a small
> amount. Does anyone have any ideas what I'm doing wrong?
>
> Thanks,
> Josh