[ODE] Extracting the rigid body rotation values

Darren Horton darren_horton at btopenworld.com
Mon Dec 15 15:04:22 MST 2003


Hi Guys,

Please excuse an ODE/Physics newbie :-)  I know a little about ODE, and I've
pretty much got my simulation set up correctly.  I have rigid bodies,
collision geometries and contact joints working well, and my rigid bodies
are colliding/acting correctly.  I'm using Visual C++ 7.0, which is
interfacing to Dark Basic Pro for graphics and sound functions.

I have my objects rendered, and I basically have several spheres dropping
onto a flat box (original huh? :-).  Positioning is working well, but I'm a
bit stuck with rotation.  The rotation function for the rendered object is
quite simple, and I have two variations:

	RotateObject(ObjectID, X, Y, Z);
or
	XRotateObject(ObjectID, X);
	YRotateObject(ObjectID, Y);
	ZRotateObject(ObjectID, Z);

X, Y and Z in this case are angles, rather than radians.

I've tried using dBodyGetRotation(), but I'm a little confused.  The docs
for v0.039 specify that dBodyGetRotation() returns a dReal *.  Under that
info, there is a comment that states "Hmmm. dBodyGetRotation returns a 4x3
rotation matrix.".  Looking from the C++ IDE, the second comment is
incorrect, and the function does actually return a dReal *.  Since I'm not
that good with either matrices or quaternions, trying to fix problems with
them or convert them to other types is a bit above my head for now!

So, what I really need is a way of extracting simple X, Y and Z rotation
angles from the result of dBodyGetRotation(), after every time step.  Once I
have the object rotation in, I should be able to delve more deeply into the
depths of this awesome physics engine :-)

If anyone could offer a C++ solution to extract these values, I would be
eternally grateful!  Again, please excuse the lack of maths knowledge.

Kind Regards,

Darren Horton.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 11/12/2003



More information about the ODE mailing list