[ODE] Trimesh collision problem
David Walters
hidden.asbestos at googlemail.com
Tue Mar 20 07:53:36 MST 2007
> thanks for your help, but it still doesnt work. Maybe that's because I use
> ODE 0.7 binary release?
I don't think so, trimeshes haven't changed in a way that would stop
this working.
>
> Btw neither in the WIKI nor in the official docu I found
> dGeomTriMeshDataBuildSingle or %Single1 - where did ya find them?
Just by browsing the source code. (Visual Assist helped) -- look at
ode/include/collsion_trimesh.h
>
> An other question: vertexpoints should be 4*dReal, how can you pass a
> pointer to your HsVector array? HsVector is a struct of 3 floats as you said
> - not 4 floats,
The parameter that you pass "4*sizeof(dReal)" into is the 'stride'. It
only actually uses the first 3 floats - but advances the pointer by
the stride instead of 3xfloat so the 4th unused float is skipped (it's
only there for alignment reasons).
To fix your problem you could either change your code to read:
// 1st Vertexpoint coordinates
dVertex[0] = 0;
dVertex[1] = 297;
dVertex[2] = 800;
dVertex[3] = 0; // Padding
// 2nd Vertexpoint coordinates
dVertex[4] = 297;
dVertex[5] = 297;
dVertex[6] = 800;
dVertex[7] = 0; // Padding
// 3rd Vertexpoint coordinates
dVertex[8] = 297;
dVertex[9] = 0;
dVertex[10] = 800;
dVertex[11] = 0; // Padding
// Polygon combo
iPoly[0] = 0;
iPoly[1] = 1;
iPoly[2] = 2;
or alternatively replace
dGeomTriMeshDataBuildSimple( idTrimeshData, dVertex, 3, iPoly, 1);
with
dGeomTriMeshDataBuildSingle( idTrimeshData, dVertex, 3 *
sizeof(dReal), 3,
iPoly, 3,
sizeof(int) * 3 );
actually, on closer inspection - it looks like your index count in
dGeomTriMeshDataBuildSimple should have been 3 and not 1.
Regards,
Dave
More information about the ODE
mailing list