btCollisionObject modification added

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
IvanBatrakov
Posts: 4
Joined: Wed Aug 24, 2011 6:08 pm

btCollisionObject modification added

Post by IvanBatrakov »

btCollisionObject needed to have information about DynamicWorld. For this purpose added void* m_userObjectPointer_0; to hold DynamicWorld pointer or handle.

Otherwise if phisical object is lost (when deleted C++ object but not deleted body handle) then unable to destroy body due to absence info about World

Needed to make changes for future version of BulletPhysics, here are modified files:

http://tmdfreegames.com/btCollisionObject.h
http://tmdfreegames.com/btCollisionObject.cpp
IvanBatrakov
Posts: 4
Joined: Wed Aug 24, 2011 6:08 pm

Re: btCollisionObject modification added

Post by IvanBatrakov »

two files

bullet-2.78\src\BulletCollision\CollisionShapes\btConvexPolyhedron.cpp
bullet-2.78\src\BulletCollision\NarrowPhaseCollision\btPolyhedralContactClipping.cpp

have the same function 'bool IsAlmostZero(const btVector3 &)'

'MAX_ITERATIONS' : macro redefinition in bullet-2.78\src\BulletCollision\NarrowPhaseCollision\btGjkConvexCast.cpp(27)
'IDX' : macro redefinition in bullet-2.78\src\BulletSoftBody\btSoftBodyHelpers.cpp(549)

needed to be removed
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: btCollisionObject modification added

Post by majestik666 »

no pointer to the world in btCollisionObject is meant
to avoid circular dependencies , so don't think this
will make it ...
IvanBatrakov
Posts: 4
Joined: Wed Aug 24, 2011 6:08 pm

Re: btCollisionObject modification added

Post by IvanBatrakov »

it is not actual pointer to World, because as it was said it is User Data and used in callback function CustomMaterialCombinerCallback to decide from what World the Handle is lost

to prevent body handle leaking and it does not concern to internal physics structure and logic

it is user level control and one user pointer is not enough

of cause can be used userpointer = malloc(sizeof(void*) * 2); to store both pointers but it can slow calculation down
and requires additionally memory control
IvanBatrakov
Posts: 4
Joined: Wed Aug 24, 2011 6:08 pm

Re: btCollisionObject modification added

Post by IvanBatrakov »

When said handle it means that C++ Bullet Physics code called from ANSI C multithreaded application environment
It helps for debugging to detect lost body handle because drawing and physics are running in separate threads
Post Reply