[ODE] get triangle index of a trimesh
Ettore Pancini
ekt at libero.it
Fri Apr 21 10:23:58 MST 2006
quite strangely i can't find the original mail from Sinecky Jaroslav
neither in the archives nor in my inbox. someone has this patch?
----- Original Message -----
From: vicente conejeros
To: ODE mailing_list
Sent: Friday, March 10, 2006 21:05
Subject: Re: [ODE] get triangle index of a trimesh
thanks :D
----- Original Message -----
From: Jaroslav Sinecky
To: adastra at inorbit.com ; vicente conejeros
Cc: ODE mailing_list
Sent: Friday, March 10, 2006 10:21 AM
Subject: RE: [ODE] get triangle index of a trimesh
So here goes the patch, maybe someone finds it useful or you can include it in unstable. It's pretty simple: after dCollide returns, call
int triIndex = dGeomTriMeshGetTouchedTriangle(g1, contactIndex);
where contactIndex is the index in the list of returned contacts and g1 is the Trimesh geom involved in the collision.
disclaimer:
- Not implemented for ray or plane colliding with trimesh. Suppose should be similarily easy to implement though.
- There is static buffer (64) to hold indexes. I believe if this overflows, it shouldn't crash, just some asserts will come out.
- It's not completely robust, for example if you send contactIndex not consistent with immediately preceding dCollide call, result is undefined
Performance impact should be negligible though.
Cheers,
Jaroslav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060421/748eda57/attachment.htm
More information about the ODE
mailing list