Very simply, it doesn't work well enough to be used by a production game right now.
Here is what I propose:
Each callback should get 2 pointers, one to each btCollisionBody that is part of the collision. From there the user can get their user pointers and do what they want.
Then there is no issue with m_userPersistenceData or what ever else is currently the method for doing this.
Probably:
Code: Select all
void CollisionAdded( btCollisionBody col0, btCollisionBody col1 );
void CollisionDestroyed( btCollisionBody col0, btCollisionBody col1 );
The current system is designed to allow the user to do things inside the physics engine pretty much exclusively (the problems with propagating user data makes game logic difficult if not impossible). But providing these new callbacks I'm talking about would be more geared towards allowing game logic to be executed with the proper information it needs.
Passing btCollisionBody to these functions is better then passing the user data pointer because it provides the link between the user data and the physical object, which allows the callback code to only execute game logic using the user data, or to also if it so chooses, do things inside the physics engine via the btCollisionBody.
Also a nicer way of registering the callbacks, maybe even a function pointer in each btCollisionObject to their individual callback which can be set using a proper function.
No more globals :/
What do you guys think? If the devs like this idea and could give me some idea of how much time this would take, I would be more then willing to write this and offer it as a patch to the SVN if the devs will actually include it. I desperately need this functionality for my project anyway.