pioneerspacesim/pioneer — pull request #2493 by Luomu (2013-10-14 18:26:48+00:00)
Title: Support collidable moving parts

About damn time, if I may say so.

From a modeller's point of view, you just name a piece of animated geometry "collision_d_whatever" (d for dynamic) and it'll be added as collidable instead of visible geometry. I recommend sticking to simple cubes, and only when they are really necessary, like space station doors.

Now, the implementation is a bit hairy... we need to to tie CollisionGeometry nodes (which may have a complex chain of transforms) into the collision system's Geom objects. To achieve this:
- CollisionVisitor links a GeomTree with a CollisionGeometry node (GeomTrees are libColliders triangle data, and shared)
- when ModelBody creates Geoms, it matches them with CollisionGeometries using the CollisionGeometry-GeomTree link (Geoms are per-body objects, and have a transform)
- before moving Geoms, ModelBody needs to accumulate the animated transform for each CollisionGeometry (implemented as DynCollUpdateVisitor)

Limitations: the way collisions work in Pioneer, moving geoms won't push the linked geoms around. That'd be... physics. Like, if a ship extends an animated landing gear into a surface, it'll just go through, and only collide when the ship moves.

The dynamic collmeshes aren't visible in the modelviewer yet because that's tricky :(