[ODE] Re: Virtual creatures (karl sims etc...)
Martin C. Martin
martin at metahuman.org
Wed May 15 06:45:02 2002
Adam Rotaru wrote:
> --- "Martin C. Martin" <firstname.lastname@example.org> wrote:
> > ... the biggest problem is that constraints aren't
> > until penetration has
> > already happened, i.e. until it's "too late." Then
> > ODE adds a force to
> > separate the two bodies.
> > ...
> > So, I'm toying around with adding the constraint a
> > timestep early, i.e.
> > on any timestep where two things would otherwise
> > start to interpenetrate.
> This sounds like a good idea, however it seems to me
> that it means double amount of work.
Well right now, I have to take 3 or 4 timesteps per frame (frame = 1/30
of a second) in order to reduce the amount of penetration. So, if I can
take bigger timesteps, this may actually save time.
> Make a time step, if there are interpenetrations add
> Rewind the time step, and repeat it anew.
I only need to do this if a new contact is added. E.g. suppose at the
start of a timestep, the only interpenetrating is a box interpenetrating
a plane at one vertex. At the end of the timestep, if that's still the
only one, or if there are none, then there's no need to rewind the
timestep. I'm hoping that covers the majority of cases, so that
rewinding a timestep will be rare.
On the other hand, adding the new constraint will cause the motions to
be different, so when we take the new timestep, we may have to rewind
again. But, because we're adding constrains with every rewind, it's
guaranteed to stop.
If the box-plane constraint goes from the box's vertex to the box's
face, this really means a bunch of contacts are added, and I probably
want to rewind and add those early. But that should be doable, and
anyway I can try ignoring that case for now, only rewinding when two
geoms first collide. That may be enough.
Any thoughts? It'll be a few weeks before I get to implementing this,
so if anyone can see any other pitfalls or options just let me know...