magnum-integration
magnum-integration copied to clipboard
2D Physics Engine
I noticed Bullet doesn't have a 2D version for its objects. Feasibly, this could be fixed in two ways:
- Create a 2D version of the Bullet objects, which would assumedly convert between the 2D magnum API's and a 2D version of Bullet shapes (similar to the current way 3D Bullet integration works, but with the Z axis disabled or some such)
- Keep the API similar, but use a Box2D backend, giving similar integration but a different and more suitable backend.
I've got experience with Box2D, if that seems more applicable to what we want in a 2D physics engine, and it's widely used and widely regarded.
Box2D would be awesome :) I also don't see Bullet matching to 2D very well.
The use case is probably a bit different, so I don't mind having a completely different API from what's done for Bullet. Makes more room for experiments.
Bullet does allow for 2D physics (see their example here), you basically register some 2D collision algorithms to the collision dispatcher, but still have to use 3D vectors it seems.
Box2D would indeed be awesome, though :D
@mosra @Squareys Looks like the proper way forward would be to embed Box2D then; it doesn't look any harder than Bullet, and it is probably more optimized towards 2D physics.
Have you checked http://chipmunk-physics.net/ ? I think it's more flexible than Box2D.
Just for the record, a very simple Box2D example is now in the examples repository. This was done directly, without creating any integration library. Potential integration lib could be based on what the example does (conversion of math types first, for example).
Btw, for reference: I remember the way to do 2D in bullet is to add a bunch of contstraints to the Z axis of all the rigid bodies.