[ODE] Trimesh related runtime error
Tomek Zielinski
tomekziel at op.pl
Sun Jul 18 02:26:41 MST 2004
Hi everybody!
Short piece of my code:
#define MAX_CONTACTS 1000
dContactGeom contact_array_helper[MAX_CONTACTS],
contact_array[MAX_CONTACTS];
unsigned int contact_num;
// there are only a few geoms in my space so ythere is no need to test
for spaces
void nearCallback(void *data, dGeomID o1, dGeomID o2)
{
// dwoch statykow nie kolidujemy
// if(dGeomGetBody(o1)==0 && dGeomGetBody(o2)==0 )
// return;
// colliding two non-space geoms, so generate contact points
between o1 and o2
int num_contact = dCollide( o1, o2, MAX_CONTACTS,
contact_array_helper, sizeof(dContactGeom) ); // ODE ERROR
// add these contact points to the simulation
for(unsigned int i=0; i<num_contact; i++)
contact_array[contact_num++] = contact_array_helper[i];
}
...
...
contact_num = 0;
dSpaceCollide( odeSpace, NULL, nearCallback );
I checked my code and I'm almost sure that setup is done properly. But
when two trimesh-bodies touches(even trimesh with box) i'm getting ODE
error "invalid operation for geom in locked
space(ode/src/collision_kernel.cpp:line301). So I checked it and it
turned out that 'ode/src/collision_kernel.cpp:line301' is inside
dGeomSetBody. I don't understand why dCollide calls dGeomSetBody - what
am I doing wrong?
----
I've just figured out that ODE itself is calling dGeomSetBody only from
dBodyDestroy, and dBodyDestroy is called only from dTestDataStructures()
which seems to be an internl ODE function... So I'm a lot more confused...
-----
I've just changed triMeshes into planes and boxes a
and now that error is gone and contact points are being generated...
-----
So how can this runtime error happen?
More information about the ODE
mailing list