# [ODE] Trimesh collision problem

Jon Watte (ODE) hplus-ode at mindcontrol.org
Tue Mar 20 09:54:07 MST 2007

```0 collisions might mean 0 collisions. What if you set that 0 to 1 ?

Cheers,

/ h+

> Hm ok I found the problem BUT I think thats a bug in ODE ...
>
> This was the relevant code that returned NO collision
> dContactGeom contact;
> int asd = dCollide( ray, idTrimesh, 0, &contact, sizeof(dContactGeom) );
>
> Changing it a little bit gives me the correct collision
> dContactGeom contact[10];
> int asd = dCollide( ray, idTrimesh, 10, contact, sizeof(dContactGeom) );
>
> As I understood the wiki, if I set the 3rd parameter to zero and point a
> single ContactGeom to the function it means that there can be only one
> collision. Now changing that to 10 possible collision it returns me one
> collision. That can't be right, can it?
>
> -----Ursprüngliche Nachricht-----
> Von: ode-bounces at ode.org [mailto:ode-bounces at ode.org] Im Auftrag von Jürgen
> 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 that’s 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
> 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
>
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://mooshika.org/mailman/listinfo/ode
>
>
>
```