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
btCollisionObject modification added
-
- Posts: 4
- Joined: Wed Aug 24, 2011 6:08 pm
Re: btCollisionObject modification added
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
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
-
- Posts: 66
- Joined: Tue Mar 02, 2010 6:13 am
Re: btCollisionObject modification added
no pointer to the world in btCollisionObject is meant
to avoid circular dependencies , so don't think this
will make it ...
to avoid circular dependencies , so don't think this
will make it ...
-
- Posts: 4
- Joined: Wed Aug 24, 2011 6:08 pm
Re: btCollisionObject modification added
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
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
-
- Posts: 4
- Joined: Wed Aug 24, 2011 6:08 pm
Re: btCollisionObject modification added
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
It helps for debugging to detect lost body handle because drawing and physics are running in separate threads