RayGeometry vs AnyOtherType collision checking only?

bartiss

07-09-2008 02:43:10

Hi,

I would like to make OgreODE ignore collision checking between all geometry types except for RayGeometry vs AnyOtherType.

I'm calculating lightmaps using ODE's collision detection. Suppose I have lots of boxes placed on a plane. All of objects use trimesh geometry for example. I use the ray to check for shadowing, but... :)

If the boxes are penetrating the plane, ODE reports collisions between boxes and plane making the calculations last much longer. If I move the boxes slightly above the ground the calculations speed up greatly, because only Ray vs. others collisions are reported.

Is there a way to do that?

rewb0rn

07-09-2008 09:28:12

Think you should not use the standard collision method because it checks all objects against all others, instead you can test each model itself for collisions, there is a method like collisionTest or similiar, dont remember. Then you would have to test every ray against all other objects.

bartiss

07-09-2008 19:21:19

Thanks for the hint! It works perfectly now :)

It's pretty obvious I guess, but maybe someday someone will be looking for this, so:

int contacts = YourTestedObject->m_Geometry->collide( m_RayGeom );
return contacts > 0;


where:
m_Geometry - your object's OdeGeometry
m_RayGeom - OdeRayGeometry used for the test