[ODE] Trimesh collision problem
Jürgen Ladstätter
info at innova-studios.com
Tue Mar 20 07:40:17 MST 2007
Hi again,
i changed some things in my code, e.g. triangle amount (1 triangle, but
value 3 to pass to the function). Still no collision
dVector3 dVertex[3];
int iPoly[3];
// 1st Vertexpoint coordinates
dVertex[0][0] = 0;
dVertex[0][1] = 297;
dVertex[0][2] = 800;
// 2nd Vertexpoint coordinates
dVertex[1][0] = 297;
dVertex[1][1] = 297;
dVertex[1][2] = 800;
// 3rd Vertexpoint coordinates
dVertex[2][0] = 297;
dVertex[2][1] = 0;
dVertex[2][2] = 800;
// Polygon combo
iPoly[0] = 0;
iPoly[1] = 1;
iPoly[2] = 2;
dTriMeshDataID idTrimeshData = dGeomTriMeshDataCreate();
dGeomTriMeshDataBuildSimple( idTrimeshData, (dReal*)dVertex,
3, iPoly, 3);
dGeomID idTrimesh = dCreateTriMesh( g_ikCDSpace,
idTrimeshData, 0, 0, 0 );
dGeomID ray = dCreateRay( g_ikCDSpace, 40 );
dGeomRaySet( ray, 280, 280, 780, 280, 280, 820 );
dContactGeom contact;
int asd = dCollide( ray, idTrimesh, 0, &contact,
dGeomTriMeshDataDestroy(idTrimeshData);
}
Int asd = ... is always 0 :(
-----Ursprüngliche Nachricht-----
Von: ode-bounces at ode.org [mailto:ode-bounces at ode.org] Im Auftrag von Jürgen
Ladstätter
Gesendet: Dienstag, 20. März 2007 14:44
An: ode at ode.org
Betreff: Re: [ODE] Trimesh collision problem
Hi dave,
thanks for your help, but it still doesnt work. Maybe thats because I use
ODE 0.7 binary release?
Btw neither in the WIKI nor in the official docu I found
dGeomTriMeshDataBuildSingle or %Single1 - where did ya find them?
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,
Kind regards,
-----Ursprüngliche Nachricht-----
Von: David Walters [mailto:hidden.asbestos at googlemail.com]
Gesendet: Dienstag, 20. März 2007 14:28
An: Jürgen Ladstätter
Cc: ode at ode.org
Betreff: Re: [ODE] Trimesh collision problem
> Everything else seems like it should work
Actually no, I think I've spotted the problem -
dGeomTriMeshDataBuildSimple takes dVertex data which is actually an
array of quad-floats, rather than three.
If you see what dGeomTriMeshDataBuildSimple resolves to, it'll make more
sense:
dGeomTriMeshDataBuildSingle1(g,
Vertices, 4 * sizeof(dReal), VertexCount,
Indices, IndexCount, 3 * sizeof(unsigned
int),
Normals);
I use:
dGeomTriMeshDataBuildSingle( g, p_vertex_data, sizeof( HsVector ),
vertex_count, p_index_data, triangle_count * 3, sizeof(
UINT32 ) * 3 );
Where HsVector is a struct of 3 floats
Hope that helps!
Regards,
Dave
_______________________________________________
ODE mailing list
ODE at ode.org
http://mooshika.org/mailman/listinfo/ode
More information about the ODE
mailing list