API Changes in libgdx Bullet Wrapper
Our master of 3D graphics and physics Xoppa has been making some API changes to our bullet physics wrapper. Here’s the word from the master himself, pay attention:
The Bullet wrapper has been updated to make it easier to work with in conjunction with the new 3D api. Due to this change, you might need to update your existing code that relies on the wrapper. I’ve tried to keep the API changes to a minimum. The main changes are:
The delete() method has been replaced by the dispose() method, every wrapper class now extends the BulletBase class which implements Disposable. The BulletBase class also manages the life cycle of each wrapper class. And it logs an error when something might go wrong, e.g. when an object isn’t properly disposed. Logging can be disabled using the arguments of the Bullet.init() method.
The “M_” prefix in getter/setter methods has been removed (e.g. btCollisionObjectWrapper.getM_collisionObject() is changed to .getCollisionObject)
The contact callback listeners (ContactAddedListenerXXX, ContactProcessedListenerXXX and ContactDestroyedListener) are merged into a single class ContactListener. The wrapper automatically detects which method(s) you’ve overridden (onContactAdded, onContactProcessed and/or onContactDestroyed). Contact filtering is now optional (depending on whether you override the method(s) with the match0 and match1 arguments).
The btIndexedMesh, btTriangleIndexVertexArray and btBvhTriangleMeshShape classes are refactored for use with the new 3D api. Moreover the Bullet class provides static helper methods to create a shape from Model Nodes. Additional methods will be added soon.
Next to these changes, the wrapper is also updated with additional functionality that shouldn’t break existing code. For example the wrapper now supports reference counting (disabled by default) and the onContactStarted and onContactEnded callbacks.
The changes will be in the nightlies in a few hours from now.