[ODE] Rotating collision body does not move rigid body

nlin@nlin.net nlin at nlin.net
Fri Aug 9 05:01:01 2002


Chris Haarmeijer  wrote:
> Am I abusing ODE or is something wrong: I have a cube without the top (5
> planes) defined as collision geometry and a sphere which is defined as
> collision geometry and a rigid body. The rigid body falls inside the cube
> and lies still on the bottom of it (which is correct). When I rotate the
> collision planes, should the rigid body move yes or no? My understanding of
> ODE says yes, but then again, i'm kind of a newbie here.... :)

First of all, you need to generate a contact joint at the point of collision,
or else the collision will not affect the simulation at all.

But a rotating geometry without an associated body has some problems.
Consider: when you "rotate" your collision geometry (which is not associated
with a body) you are instantaneously moving from a valid (non-colliding, or
non-penetrating) configuration to an invalid configuration (penetrating).
From ODE's point of view, it's exactly the same as if your collision geometry
suddenly materialized right in the middle of your sphere (which has geometry
and a rigid body).

So what can ODE do? The sphere was not moving beforehand, and suddenly
there's this plane (or multiple planes) embedded inside of it, which have
no rigid body information associated with it. It can't dynamically resolve
the collision based on the "movement" of the plane, because from ODE's point
of view, the plane isn't moving - it just suddenly materialized.

The best ODE can do is to try to push the sphere back out of the plane to
move the system back into a legal configuration, and possibly to add a
"bounce" factor (specified in the contact joint) by mirroring (and reducing)
the velocity along the contact normal. Moving back into a legal configuration
is the role of the ERP, the error reduction parameter. Here, the error is
the amount of penetration, and depending on how high you set ERP, that will
control how much of a "spring force" is used to push the sphere back out.
Since no other forces are acting on your sphere, if you set ERP too high, the
sphere will fly away wildly.

The problem is that your sphere was not moving at all when the plane(s)
suddenly materialized inside of your sphere. So there is no relative velocity
to mirror, so there is initially no bounce. Only after the ERP starts to push
the sphere out of the plane will the sphere gain velocity (thus unphysically
gaining energy in the process, but your planes were also unphysically rotating
without any mass). This added energy might cause "superball" type behavior
where the sphere flies off wildly - depending on how high your ERP is and
how fast you rotate your planes.

I think it would probably be best to use boxes (with bodies and mass) to model
your movable geometry, since the alternative, movable geometry without any
rigid body information, is sort of a violation of the assumptions of a rigid
body simulator - you are discontinuously moving the system into illegal
(penetrating) configurations, so the best the simulator can do is to somehow
try to "cope".

-Norman