[ODE] Trimesh - box collision problem

Marco Grubert mgrubert at conitec.net
Tue Jan 24 12:37:03 MST 2006


Old Opcode versions used to filter out single triangle meshes. Maybe that's 
why you need the extra one.

- Marco

----- Original Message ----- 
From: "Matthias Weigand" <weigole at gmx.de>
To: <ode at q12.org>
Sent: Tuesday, January 24, 2006 02:05
Subject: [ODE] Trimesh - box collision problem


> Hi,
>
> I have some weird collision problems with a trimesh and a box. Below I'm
> building up a triangle mesh with simply two triangles. And test it
> against a box, that should definitly collide with the first triangle.
> But in the code below it does not collide, until I do one of the 
> following:
> - Pass 3 instead of 6 to the indexCount parameter of
> dGeomTriMeshDataBuildSimple.
> - Set the height of the second triangle to 60.
> - Link the program against the debug build of ODE's library (producing
> debugging symbols was essential)
>
> int main()
> {
>  //vertices
>  //colliding triangle
>  dVector3 v[6];
>  v[0][0] = 0;
>  v[0][1] = 74;
>  v[0][2] = 16;
>
>  v[1][0] = 16;
>  v[1][1] = 74;
>  v[1][2] = 16;
>
>  v[2][0] = 16;
>  v[2][1] = 74;
>  v[2][2] = 0;
>
>  //useless triangle
>  v[3][0] = 0;
>  v[3][1] = 0;
>  v[3][2] = 1;
>
>  v[4][0] = 1;
>  v[4][1] = 0;
>  v[4][2] = 0;
>
>  v[5][0] = 1;
>  v[5][1] = 0;
>  v[5][2] = 1;
>
>  //indices
>  int32 i[6];
>  for (int32 s=0; s < 6; s++) i[s] = s;
>
>  dTriMeshDataID tridata = dGeomTriMeshDataCreate();
>  dGeomTriMeshDataBuildSimple(tridata, (dReal*)v, 6, i, 6);
>  dGeomID mesh = dCreateTriMesh(0, tridata,NULL,NULL,NULL);
>
>  dGeomID boxt = dCreateBox(0,5,5,5);
>  dGeomSetPosition(boxt,16,76,8);
>
>  dContactGeom g;
>  cout << dCollide(boxt,mesh,1,&g,sizeof(dContactGeom));
>
>  return 0;
> }
>
> What the hell is going on here?
>
> BTW: A sphere behaves correctly.
>
> Thanks for help,
> weigo
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode 



More information about the ODE mailing list