[ODE] Terrain: collision test culling
Hannes Norda
norda at customred.com
Mon Aug 9 19:54:37 MST 2004
johnmcTemp at netscape.net wrote:
>
>Hannes. When I sent a reply to ode, I think I may have had your address
>as the reply address. Sorry. ;)
>
>
No problem, made same mistake myself a couple of times ;)
Been a busy day so I haven't had time to answer yet....
>
>
>>Hannes wrote:
>>have a look at collide/category bits
>>http://www.ode.org/ode-latest-userguide.html#sec_10_5_1
>>They let you cull collisions early, just before the AABB-test I think.
>>
>>
>
>Will have to read through it. I was doing something similar by setting the
>user data within the geom, and testing that data, so this may be a lot cleaner!
>
>
Yes, and certainly a lot faster. With this the collisions you don't want
wont even show up in NearCollisionCallback at all. And ODE doesn't even
have to bother wether the objects collide or not, earliest escape
possible I guess.
>
>
>>Also you could try to put all your static geometry in one space and
>>dynamic (and static you still wanna check against 'static world') in
>>another space.
>>
>>Now when you check for collisions you just collide the dynamic with the
>>static and then the dynamic with itself. Thus not checking for
>>collisions between static world at all.
>>
>>
>
>Im gonna try this out now. It sounds really cool. If it works, like you say, I will jump for joy!
>
>
Certainly works well for me. As a note, I created both staticspace and
dynamicspace in the same "rootspace". But you _shouldn't_ call
dSpaceCollide on that rootspace.
>
>
>>I also built my staticspace with subspaces, based on the octree I use
>>for rendering.
>>
>>
>
>I am curious. Since spaces are 'unplaceable', if I use a quadtree space, doesnt using subspaces negate the benefits of how a quadtree partions the space??!!! Let me explain: If you didnt have subspaces, then I hope that when an object is tested, it goes down the quadtree, only colliding with objects within collision range of that area. With subspaces, does each subspace have to test with each other subspace, then, the colliding subspaces do there collision between. Would seem like no culling using a division of space like a quadtree would help. ...I guess this may be an OPCODE thing, I dont know...
>
>- John
>
>
Yes, that is true. But in my case, sometimes my levels spread a lot
vertically, and quadspace obviously only divides horizontally. So I
chose to go with hashspaces instead and I am creating a hashspace for
each leaf in the octree. Also, you cannot collide a quadspace with
another space since dSpaceCollide2 isn't implemented for quadspaces.
This has given me best results so far. Originally I used a quadspace and
inserted both static and dynamic objects into it, culling collisions
with collide/category bits, but I got better performance from dumping
the quadspace. I don't know if other people have had other experiences,
would be nice to hear if someone else has some good tricks to pull out
and show us!
Cheers!
/Hannes
More information about the ODE
mailing list