[ODE] Autodisable collision detection

Joe Ante joe at uti.is
Thu May 27 23:31:39 MST 2004


> Hello Joe,
> 
> This is exactly the same thing as we do in S.T.A.L.K.E.R. :)
> And I have to admit it works really well, so it is proven to work.
> 
> And another one thing to note: enabling can be done at collision
> level, that way you don't have any issues with bodies enabled after
> collision phase and missing contact info for one physics step.
Hi Oles,

This is exactly the issue I am having right now with autodisable.
When I don¹t do collision detection between two disabled bodies in the
wallstack no joint is created. Thus the objects miss out the contact joint
for one physics step, which makes the stacks wave up and down and never come
to rest. 

You can see the problem at work by adding the following code inside
nearcallback of test_crash.cpp:
    if (b1 &&b2)
    {
        if (!dBodyIsEnabled (b1) && !dBodyIsEnabled (b2))
            return;
    }


Oles, how exactly did you solve this issue? Can you share the code that does
it?

As far as I can see there are two ways of solving it:

- persistent contacts for disabled bodies

When two bodies get disabled. A persistent contact joint is generated and
stored in a separate joint group.

The problem I see is that its hard to get right in a general way and has
many pitfalls eg. What happens if you move a static collider. There is no
way to find that out and remove the static collider in a general way.


- enabling at collision level.
When a collision between a sleeping and awake body happens the sleeping body
is enabled and is stored in a list.
After collision detection is done. All bodies in the list are collided
against all disabled bodies again, to see if they penetrate any other
disabled bodies.
This has to be done iteratively until no bodies became enabled.
I am not sure if it is necessary to iterate at all but it sure seems
(I am not sure if this is actually necessary, but it seems more correct.)

Anyway while that seems like a viable solution, to me it seems that the
usage of ode just gets a lot more complex in order to get autodisable
running with the full benefit.

Because what you need to get it running is:
A) 2 callbacks when a body gets enabled/disabled, which moves two bodies
from an enabled space to an disabled space.
B) You need to call dSpaceCollide on the enabled space and dSpaceCollide2 on
enabled/disabled spaces.
C) You need to iteratively enable bodies that are colliding with through
collision detection enabled bodies.

To me it seems that this functionality should be moved more into the spaces.
So a user doesn¹t have to bother about all this. He just gets optimal
performance for sleeping bodies out of the box.

Any ideas?
Are there simpler ways to get this working properly?

Joe Ante
www.otee.dk




More information about the ODE mailing list