[ODE] dBodySetRotation & dBodyGetRotation not symmetric

imcmeans at telus.net imcmeans at telus.net
Tue Jul 13 19:37:00 MST 2004


Hi, I was wondering if anyone could explain what is going on here. I'm trying to
use ODE across a network, and that involves reading the important values
(position, speed, rotation) on the server and setting them on the client. Since
my game is only in 2D (I'm using
http://www.mathematik.uni-bielefeld.de/~pserocka/ODE-Plane2D/ ), I only need a
few values to transmit, namely the 2D position and velocity and the rotation
about the z axis.

However, I'm running across a problem that I can't figure out when trying to set
and restore rotation matrices. In the ODE userguide, it says that
dBodyGetRotation returns a 3x4 rotation matrix. However, even taking this into
account, I don't understand what's going on. See this code snippet:

const dReal matrix[] = { /* numbers here edited out... shown below */ };
dBodySetRotation(body, matrix);
const dReal* rot = dBodyGetRotation(body);

In the debugger, I see this: the variable matrix is a rotation of 45 degrees ccw
about the z axis:
-	matrix	0x0012f894	const double [9]
	[0]	0.70710676573223719	const double
	[1]	-0.70710679664085752	const double
	[2]	0.00000000000000000	const double
	[3]	0.70710679664085752	const double
	[4]	0.70710676573223719	const double
	[5]	0.00000000000000000	const double
	[6]	0.00000000000000000	const double
	[7]	0.00000000000000000	const double
	[8]	1.0000000000000000	const double


and the variable rot seems to be completely unrelated!

-	rot,12	0x04942da8	const double *
	[0]	1.0000000000000000	const double
	[1]	2.1607691937017854e-062	const double
	[2]	-3.0557890988910417e-062	const double
	[3]	0.00000000000000000	const double
	[4]	2.1607691937017854e-062	const double
	[5]	-1.0000000000000000	const double
	[6]	5.2165582925928285e-062	const double
	[7]	0.00000000000000000	const double
	[8]	-3.0557890988910417e-062	const double
	[9]	-5.2165582925928285e-062	const double
	[10]	-1.0000000000000000	const double
	[11]	0.00000000000000000	const double

Have people run into this before? Why is it that GetRotation gets something
completely different than what SetRotation just set?



More information about the ODE mailing list