[ODE] dGeomSetBody
Ryan O'Connor
ryan at pcsoftware.co.nz
Wed Sep 28 11:36:56 MST 2005
Hi. Whenever I use dGeomSetBody, MSVC++7 breaks into dbgheap.c with this
error:
Unhandled exception at 0x7c901230 in AR_Example_Models.exe: User breakpoint.
If I look at the call stack I can see dGeomSetBody was called, then dFree()
for some reason which uses free() in windows. I've tried a debug version of
ODE (I'm using SINGLE-DEBUG-TRIMESH precompiled for msvc7), but I get the
same error.
I think it migth be some problem with my application's heap. Would this be
because I'm calling ODE wrapper functions inside a dll that's dynamically
linked?
The problematic code is below, and it is executed after the basic code like
setting up the world and space etc, as in the test applications:
Ball::Ball(void)
{
m_radius = 5;
m_density = 10;
//Create body in world
m_body = g_PhysicsManager.CreateBody();
dBodySetPosition(m_body, 0,5,0);
//Create geometry for ball in global hash space
m_geom = g_PhysicsManager.CreateSphere( m_radius );
// Bind them together to make a dynamics object
// EXCEPTION AT THIS LINE
dGeomSetBody( m_geom, m_body);
RecalculateMass();
}
g_PhysicsManager is a dllexport "ARPhysicsManager" class in my library, both
the library and application (AR_Example_Models) link with ode.lib.
CreateBody() and CreateSphere() simply wrap the 2 ODE functions at the
moment inside the library, like so:
dBodyID ARPhysicsManager::CreateBody()
{
return dBodyCreate(m_world);
}
dGeomID ARPhysicsManager::CreateSphere(float radius)
{
return dCreateSphere(m_space,radius);
}
All my variables seem to be initialised to valid pointers. Is there
something obvious I've forgotten? Anything else I could try to further debug
it?
More information about the ODE
mailing list