[ODE] Getting Triangle Index from a ray-trimesh collision?

Cristian Bianchi cris at cris.hspace.name
Wed Mar 16 09:25:14 MST 2005


Hello,
You should use the ray callback feature. Ode allows you to specify a
callback function for each trimesh geom. take a look at the user guide:

typedef int dTriRayCallback (dGeomID TriMesh, dGeomID Ray, int
TriangleIndex, dReal u, dReal v);
void dGeomTriMeshSetRayCallback (dGeomID g, dTriRayCallback* Callback);
dTriRayCallback *dGeomTriMeshGetRayCallback (dGeomID g);
        Optional Ray callback. Allows the user to determine if a ray
collides with a triangle based on the barycentric coordinates of an
intersection.

Every time a ray - trimesh collision occurs, the specified callback is
called and you can use the TriangleIndex for your purposes.

Regards
Cristian Bianchi
Simulation Software Division
DIES Group srl - Rome, Italy

----- Original Message ----- 
From: "Patrick McColgan" <patrick at torcinteractive.com>
To: <ODE at q12.org>
Sent: Tuesday, March 15, 2005 6:40 PM
Subject: [ODE] Getting Triangle Index from a ray-trimesh collision?


> Hello
>
> I'm looking to collide a ray with a trimesh but on collision I want to
> know the index of the triangle in the trimesh involved.  I've searched
> the mailing list and looked through the documentation and from what I
> can see there is no function to return triangle indices.
>
> Stepping through the collider I can see where the index is found and
> used but currently it isn't returned, is there any external way of
> retrieving it?  Are there any functions at all that return a triangles
> index?
>
> Thanks
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>



More information about the ODE mailing list