[ODE] Getting Triangle Index from a ray-trimesh collision?
Patrick McColgan
patrick at torcinteractive.com
Mon Mar 21 10:08:09 MST 2005
Thanks for the replies, I actually got it working last Wednesday using
the callback (thanks I wasn't sure initially if they were going to do it).
Altering the source probably would have been easier, using the callback
doesn't generate contacts so for my purposes I've taken a brute force
approach of a standard ray test followed by a ray callback enabled test.
Geoff Carlton wrote:
> This may be able to be used in the simple ray-triangle case, but in
> general ode needs a way of associating contacts and the actual
> triangle index. To do this, you have to extend dContactGeom and add
> two extra fields:
> int side1,side2;
> These can be set in the trimesh colliders to the appropriate triangle
> index. Furthermore, they could be extended in future to return side
> information about other geom types, for example side [0..5] for a
> box. This was discussed previously, and I have implemented it, but
> due to other changes I don't have a nice diff to send.
>
> Geoff
>
>
> Cristian Bianchi wrote:
>
>> 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
>>>
>>>
>>
>>
>> _______________________________________________
>> ODE mailing list
>> ODE at q12.org
>> http://q12.org/mailman/listinfo/ode
>>
>>
>>
>>
>>
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
>
More information about the ODE
mailing list