[ODE] Laser range finder

John Miles jmiles at pop.net
Sun Sep 19 15:34:42 MST 2004


> To paraphrase the documentation (did you search for "ray" ?)
>
> 1) create a dRay geom
> 2) set the position and direction appropriately using the dRay functions
> 3) set the length to be the total size of your world
> 4) run dSpaceCollide2() to collide your ray against the world
> 5) the contact you get back from within dCollide has a "depth"
> value which is the length of the ray to the contact -- remember,
> and use, the smallest depth returned

FYI, be careful using really-long rays with the dTerrainY/Z contributions.
If you fire a ray at an angle that the terrain collider doesn't trivially
reject (e.g., 45 degrees from just above the center of a world to a point
beneath one of its corners) , performance suffers greatly compared to an
orthogonal ray, or a shorter one.

Or, that may be a general property of the quadtree space, for all I know.  I
didn't investigate.

The other thing about rays is that they "miss" trimeshes if they happen to
strike an edge.

-- jm



More information about the ODE mailing list