[ODE] Porting codebase from 0.35 to 0.39

Shamyl Zakariya zakariya at earthlink.net
Fri Sep 26 09:10:36 MST 2003

This morning, after spending a week mucking about with 0.39 (making 
tricollider work right on Mac OS X, etc) I decided it was ready (or 
ready enough) to move my project forward from 0.35 to 0.39.

For reference, the demos all worked, and a couple test projects I wrote 
worked fine.

I got a very peculiar and baffling problem. This is likely not an ODE 
issue, per se, but perhaps people here have seen this.

Basically, I've got a c++ class, cylinder object,

CylinderObject::CylinderObject( std::string name, dWorldID world, 
dSpaceID space,
	dVector3 position, dReal length, dReal radius, dReal mass,
	dVector3 rotAxis, dReal rotAngle, dVector3 color, SimObject *relTo )
	:SimObject(name), _body(0), _geom(0), _transform(0)

	dMass m;
	dMassSetCappedCylinder (&m, 1.0, 3, radius, length ); // <-- aborts 
	dMassAdjust (&m, mass );
	_body = dBodyCreate (world);
	dBodySetMass (_body,&m);
	_geom = dCreateCCylinder (space, radius, length);
	dGeomSetBody (_geom, _body);

	_color[0] = color[0];
	_color[1] = color[1];
	_color[2] = color[2];
	setupPosition( position, rotAxis, rotAngle, relTo );

Now, what's happening is I get this:
ODE INTERNAL ERROR 2: bad direction number in dMassSetCappedCylinder()

Looking at the source, the assert is:
	dUASSERT (direction >= 1 && direction <= 3,"bad direction number");

Now, looking at my code, it's obviously passing a 3. So I run the 
debugger... and the debugger reports correct values for everything 
passed ( mass pointer, density, radius, & length ), but it reports that 
I passed the integer value -1073749696...

For reference, I didn't have this problem with ode 0.35; I rebuilt my 
project using 0.35 and this didn't show up.

Can anybody tell, or guess, what's going on? I also tried making the 
reference to '3' be a local variable, so I could verify it's value at 3 
in the debugger. Same problem.

Also, for what it's worth, the ode library I'm using is a custom built 
OS X framework, not the default one made by the makefile (I'm a fan of 
OS X frameworks, since they include binary and headers into one package 
-- also, I built 0.35 as a framework and didn't have this problem). 
Since the default test programs and my personal tests worked ( all 
linking against the framework) I have to assume something dirty is 
happening. I'm very confused.

shamyl zakariya
   "Our response to being bored and rich is not to discard
   possessions and live more simply, but to buy more stuff
   to reduce the space in which we might contemplate
   our shame."

More information about the ODE mailing list