[ODE] Extracting the rigid body rotation values

Vrej Melkonian vmelkon at yahoo.com
Mon Dec 15 10:04:56 MST 2003


Hi Darren,

I'm new to ODE myself but I'll try to help.

dBodyGetRotation() returns the 4x3 martrix like it
says.

Looking at the drawstuff code that comes with ODE,
it just contructs a matrix (4x4) and uploads to
OpenGL.
It does that by filling in the upper 3x3 section with
the rotation values (the matrix values actually), and
concatenates the position vector on the right, then
fills the last row with 0 0 0 1.

Maybe you can do the same with Dark Basic.






--- Darren Horton <darren_horton at btopenworld.com>
wrote:
> 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
> 
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/


More information about the ODE mailing list