[ODE] Trimesh Collision Issues

Brian Uptagrafft instruo at hotmail.com
Sun Jul 17 08:10:50 MST 2005


Hi everyone,

I'm quite new to ODE (great job, btw, to everyone involved!) and at the 
moment I'm simply looking to wrap the trimesh-trimesh collision 
functionality into my .Net application.  Everything is trucking along fine, 
save I throw an exception when I try to use dCollide with my pair of 
trimeshes.  My code is posted below (note:  the ODE::ode_method_name  is 
simply passed through to the ode.dll via the .Net InteropServices and 
doesn't seem to be the problem, by and large, because all of the other 
functions besides dCollide are behaving).  Oh, and I'm linking to the 
ode-bin-0.5-msvc-dll-SINGLE-release-trimesh version of the dll.  Here's the 
code, and hopefully you can see something I've missed.  Thanks!

int data_id = ODE::dGeomTriMeshDataCreate();
int data_id2 = ODE::dGeomTriMeshDataCreate();

dVector3 verts[3];

verts[0][0] = 0.0;
verts[0][1] = 0.0;
verts[0][2] = 0.0;

verts[1][0] = 1.0;
verts[1][1] = 0.0;
verts[1][2] = 0.0;

verts[2][0] = 1.0;
verts[2][1] = 1.0;
verts[2][2] = 0.0;

int indices[3];
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;

dVector3 verts2[3];

verts2[0][0] = 0.0;
verts2[0][1] = 0.0;
verts2[0][2] = 0.0;

verts2[1][0] = 1.0;
verts2[1][1] = 0.0;
verts2[1][2] = 0.0;

verts2[2][0] = 1.0;
verts2[2][1] = 1.0;
verts2[2][2] = 0.0;

int indices2[3];
indices2[0] = 0;
indices2[1] = 1;
indices2[2] = 2;

ODE::dGeomTriMeshDataBuildSimple( data_id, verts, 3, indices, 3);

ODE::dGeomTriMeshDataBuildSimple( data_id2, verts, 3, indices, 3);

int space_id = ODE::dSimpleSpaceCreate(0);

int geom_id = ODE::dCreateTriMesh(space_id, data_id);
int geom_id2 = ODE::dCreateTriMesh(space_id, data_id2);

dContactGeom contacts[1];

cout << ODE::dCollide(geom_id, geom_id2, 0, contacts, sizeof(dContactGeom)) 
<< endl;




More information about the ODE mailing list