2D Environment
-
- Posts: 8
- Joined: Wed Nov 29, 2006 12:36 am
2D Environment
What would be the easiest way to adapt bullet dynamics to a 2d environment?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: 2D Environment
- The main change would be to adapt the constraint solver. Right now, Bullet uses a btSequentialImpulseConstraintSolver. One could simplify it to just be 2D, then it becomes like Erin Catto's Box2D.samy wrote:What would be the easiest way to adapt bullet dynamics to a 2d environment?
- Clamp the world transform to 2D coordinates every frame.
- The collision detection might need some 2D changes, it depends which 2D shapes you need. You can register 2D collision algorithms to the dispatcher, CollisionAlgorithms are called Arbiters in Erin's Box2D.
A lot of 3D collision algorithms can be used without modification for 2D cases as long as you clamp contact point coordinates (see next step).
- If you use 3D collision algorithms, for newly added contact points: clamp one component to zero. You can use the ContactAddedCallback for this.
Another approach is to add a '2D constraint'. I heard that in ODE they did something like 'Flatland'.
It would be a fun and not too difficult task to work on, if one has time
Erwin