[ODE] Space additions for dRay

David McClurg dmcclurg at pandemicstudios.com.au
Mon Aug 5 16:16:01 2002


> // Collides a single geometry with the other geometries in the space
> void dSpaceCollideGeom (dSpaceID space, dxGeom* g, void *data, dNearCallback *callback);

This sounds pretty useful for casting some rays down on a terrain mesh and showing a quick topo map or building a shadow off-line.  I suppose I could go directly to Opcode for that, but where is the Opcode documentation?  I only know about the white paper which didn't help me much...

http://www.codercorner.com/Opcode.pdf

Also, I have a question about tri-lists in ODE.  If I want to create several of them so collisions can be seperately detected, how do I avoid ODE trying to collide them against each other?  If I put them in a geomGroup then I don't get to know which mesh actually collided.  Also, if neither has a body, why are they even tested against each other?

Thanks Erwin

-----Original Message-----
From: Erwin de Vries [mailto:erwin@vo.com]
Sent: Monday, 5 August 2002 5:33 AM
To: ode@q12.org
Subject: [ODE] Space additions for dRay


Hi,

Today i've added some new stuff to the space. (Hash & simple) The concept is
'locking' the space. A locked space is a space where no modifications to
itself and the geometries it contains are allowed. Internally the space_aabb
pointers are calculated once in a Lock()/Unlock() sequence. Nested
lock/unlock pairs are not allowed.

It can be used to do instant collision detection for (but not limited to)
rays with minimal overhead.

The implementation is as follows:

// Puts the space in locked mode.
void dSpaceLock (dSpaceID space);

// Collides a single geometry with the other geometries in the space
void dSpaceCollideGeom (dSpaceID space, dxGeom* g, void *data, dNearCallback
*callback);

// Puts the space back in normal mode.
void dSpaceUnlock (dSpaceID space);

// Tells whether the space is currently locked.
int dSpaceLocked(dSpaceID space);

Thats it. These functions do not interfere with current behavior, so it is
all backwards compatible.

A current problem is dBodySetPosition(), etc. Unlike dGeomSetPostition(),
etc, we cant assert these, because there is no telling which geometries
point to a body's data. I dont have a good solution to this problem. What
would be possible is to regenerate a list of AABB's in the dSpaceUnlock()
function, and compare it to the one generated in the previous dSpaceLock().
If they dont match, assert. Only in debugmode of course.

I'll post this soon. Would you like to add this to the core code, Russ? I
just created it, so i havent tested it much, but i will do so the next days
It passes the space test incuded with ODE. Internally i had to change some
things in the hashspace. It now uses buffered allocations (using dArray)
instead of stack allocations for the lists of objects, which of course might
be a little slower, and certainly uses more memory. But i've not yet tested
how much. Couldnt be -that- much.

Erwin