ODE Ray as in Ogre

Djoef

03-08-2007 21:44:59

Hey,
I would like to make a ODE ray which has the same capabilities of a standard OGRE::Ray.

Meaning that I can define a ray, and query which objects its intersecting.
The main point here would be to know if an object is visible.

The way i could do it now :
Make a ray and perform several dCollide's for the object of interest with each time another possible occluder. And then compare the depths.

Or maybe something with dSpaceCollide2 as it would give back the possible intersectors. (but i did not try that yet)

I was also thinking of executing the normal Ogre Ray and do a ODE ray on all the intersected AABBs in the list retrieved from the Ogre Ray...

Is there not something as a standard OGRE ray but for OgreODE ?
Just define the ray and get back a list with the collided geoms ordered by depth.

If possible could you also give the name of the function, and eventually a line of example code... (or pseudocode)

that would be verry nice ;)

tnx!
geoffrey.

rewb0rn

08-08-2007 13:02:55

i am having difficulties with my comp so i can not access any source code right now (working at lappi) but i do something similar.

1) you should not use any function that begins with a d, these are ode functions and are wrapped in OgreOde.
2) You can create a RayGeometry and then collide it by hand with every object that might be intersecting it, giving a function pointer for callback if there was a hit. unfortunately i dont know the functions name now, but it should be a member function of that raygeometry with an appropriate name.

note: if its about visibilty, results maybe do not have to be exact, so using an ogre ray might be faster with less accuracy. depends on what you want to do.