Improved CharacterDemo/KinematicCharacterController, dynamic objects will bounce off.

Don't create a todo list for doxygen by default (the chaotic todo's would confuse most developers)
Improve support for small objects, by having dynamic contact breaking thresholds. Still needs small internal timestep and some GJK improvements.
This commit is contained in:
erwin.coumans
2008-11-05 03:28:10 +00:00
parent f964c2f644
commit d25d264e77
20 changed files with 81 additions and 73 deletions

View File

@@ -16,7 +16,7 @@ subject to the following restrictions:
#include "btPersistentManifold.h"
#include "LinearMath/btTransform.h"
#include <assert.h>
btScalar gContactBreakingThreshold = btScalar(0.02);
ContactDestroyedCallback gContactDestroyedCallback = 0;
@@ -66,7 +66,7 @@ void btPersistentManifold::clearUserCache(btManifoldPoint& pt)
printf("error in clearUserCache\n");
}
}
assert(occurance<=0);
btAssert(occurance<=0);
#endif //DEBUG_PERSISTENCY
if (pt.m_userPersistentData && gContactDestroyedCallback)
@@ -164,7 +164,7 @@ int btPersistentManifold::getCacheEntry(const btManifoldPoint& newPoint) const
int btPersistentManifold::addManifoldPoint(const btManifoldPoint& newPoint)
{
assert(validContactDistance(newPoint));
btAssert(validContactDistance(newPoint));
int insertIndex = getNumContacts();
if (insertIndex == MANIFOLD_CACHE_SIZE)
@@ -190,7 +190,7 @@ int btPersistentManifold::addManifoldPoint(const btManifoldPoint& newPoint)
btScalar btPersistentManifold::getContactBreakingThreshold() const
{
return gContactBreakingThreshold;
return m_contactBreakingThreshold;
}

View File

@@ -24,7 +24,7 @@ subject to the following restrictions:
struct btCollisionResult;
///contact breaking and merging threshold
///maximum contact breaking and merging threshold
extern btScalar gContactBreakingThreshold;
typedef bool (*ContactDestroyedCallback)(void* userPersistentData);
@@ -52,6 +52,8 @@ ATTRIBUTE_ALIGNED16( class) btPersistentManifold
/// void* will allow any rigidbody class
void* m_body0;
void* m_body1;
btScalar m_contactBreakingThreshold;
int m_cachedPoints;
@@ -68,10 +70,11 @@ public:
btPersistentManifold();
btPersistentManifold(void* body0,void* body1,int bla)
: m_body0(body0),m_body1(body1),m_cachedPoints(0)
btPersistentManifold(void* body0,void* body1,int bla, btScalar contactBreakingThreshold)
: m_body0(body0),m_body1(body1),m_cachedPoints(0),
m_contactBreakingThreshold(contactBreakingThreshold)
{
(void)bla;
}
SIMD_FORCE_INLINE void* getBody0() { return m_body0;}