[ODE] de-activated bodies

David McClurg dmcclurg at pandemicstudios.com.au
Wed Sep 11 22:03:59 2002


In coding up a game, it is often necessary to de-activate a physics body.  Here are some examples,

- in a turn-based game, only the current player should be able to move.  all other players should collide but be frozen in place and act like a piece of furniture.
- floating powerups (gravity mode = 0) should collide with the player *BUT* when the player is far enough away, the powerup bodies are de-activated so they don't take up CPU cycles.

So... I'm proposing something like the dxBodyDisabled flag but without the caveat where it gets re-enabled...
---
If there are any enabled bodies in an island then every body in the island will be enabled at the next simulation step. Thus to effectively disable an island of bodies, every body in the island must be disabled. If a disabled island is touched by another enabled body then the entire will be enabled, as a contact joint will join the enabled body to the island.
---

Is there any way to prevent a body from getting re-enabled automatically?  How about a dxBodyFrozen or dxBodyDeactivated flag?

Also, I tried unlinking the body temporarily with dGeomSetBody(g, NULL) but ODE didn't seem to like that and collisions seemed to miss a frame on the geom.  This didn't seem like a good idea in the middle of a simulation but let me know.

Ta