Synchronized changes of Bullet, from Blender.
Added optional flag btSoftBody::appendAnchor( int node,btRigidBody* body, bool disableCollisionBetweenLinkedBodies=false), to disable collision between soft body and rigid body, when pinned Added btCollisionObject::setAnisotropicFriction, to scale friction in x,y,z direction. Added btCollisionObject::setContactProcessingThreshold(float threshold), to avoid collision resolution of contact above a certain distance. Avoid collisions between static objects (causes the CharacterDemo to assert, when a dynamic object hits character)
This commit is contained in:
@@ -82,7 +82,9 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1)
|
||||
//test for Bullet 2.74: use a relative contact breaking threshold without clamping against 'gContactBreakingThreshold'
|
||||
//btScalar contactBreakingThreshold = btMin(gContactBreakingThreshold,btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold()));
|
||||
btScalar contactBreakingThreshold = btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold());
|
||||
|
||||
|
||||
btScalar contactProcessingThreshold = btMin(body0->getContactProcessingThreshold(),body1->getContactProcessingThreshold());
|
||||
|
||||
void* mem = 0;
|
||||
|
||||
if (m_persistentManifoldPoolAllocator->getFreeCount())
|
||||
@@ -93,7 +95,7 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1)
|
||||
mem = btAlignedAlloc(sizeof(btPersistentManifold),16);
|
||||
|
||||
}
|
||||
btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0,contactBreakingThreshold);
|
||||
btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0,contactBreakingThreshold,contactProcessingThreshold);
|
||||
manifold->m_index1a = m_manifoldsPtr.size();
|
||||
m_manifoldsPtr.push_back(manifold);
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@ subject to the following restrictions:
|
||||
#include "btCollisionObject.h"
|
||||
|
||||
btCollisionObject::btCollisionObject()
|
||||
: m_broadphaseHandle(0),
|
||||
: m_anisotropicFriction(1.f,1.f,1.f),
|
||||
m_hasAnisotropicFriction(false),
|
||||
m_contactProcessingThreshold(1e30f),
|
||||
m_broadphaseHandle(0),
|
||||
m_collisionShape(0),
|
||||
m_rootCollisionShape(0),
|
||||
m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT),
|
||||
|
||||
@@ -52,6 +52,11 @@ protected:
|
||||
//without destroying the continuous interpolated motion (which uses this interpolation velocities)
|
||||
btVector3 m_interpolationLinearVelocity;
|
||||
btVector3 m_interpolationAngularVelocity;
|
||||
|
||||
btVector3 m_anisotropicFriction;
|
||||
bool m_hasAnisotropicFriction;
|
||||
btScalar m_contactProcessingThreshold;
|
||||
|
||||
btBroadphaseProxy* m_broadphaseHandle;
|
||||
btCollisionShape* m_collisionShape;
|
||||
|
||||
@@ -127,6 +132,30 @@ public:
|
||||
return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE) )==0);
|
||||
}
|
||||
|
||||
const btVector3& getAnisotropicFriction() const
|
||||
{
|
||||
return m_anisotropicFriction;
|
||||
}
|
||||
void setAnisotropicFriction(const btVector3& anisotropicFriction)
|
||||
{
|
||||
m_anisotropicFriction = anisotropicFriction;
|
||||
m_hasAnisotropicFriction = (anisotropicFriction[0]!=1.f) || (anisotropicFriction[1]!=1.f) || (anisotropicFriction[2]!=1.f);
|
||||
}
|
||||
bool hasAnisotropicFriction() const
|
||||
{
|
||||
return m_hasAnisotropicFriction;
|
||||
}
|
||||
|
||||
///the constraint solver can discard solving contacts, if the distance is above this threshold. 0 by default.
|
||||
///Note that using contacts with positive distance can improve stability. It increases, however, the chance of colliding with degerate contacts, such as 'interior' triangle edges
|
||||
void setContactProcessingThreshold( btScalar contactProcessingThreshold)
|
||||
{
|
||||
m_contactProcessingThreshold = contactProcessingThreshold;
|
||||
}
|
||||
btScalar getContactProcessingThreshold() const
|
||||
{
|
||||
return m_contactProcessingThreshold;
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE bool isStaticObject() const {
|
||||
return (m_collisionFlags & CF_STATIC_OBJECT) != 0;
|
||||
|
||||
@@ -47,6 +47,12 @@ public:
|
||||
|
||||
btScalar getRadius() const { return m_implicitShapeDimensions.getX() * m_localScaling.getX();}
|
||||
|
||||
void setUnscaledRadius(btScalar radius)
|
||||
{
|
||||
m_implicitShapeDimensions.setX(radius);
|
||||
btConvexInternalShape::setMargin(radius);
|
||||
}
|
||||
|
||||
//debugging
|
||||
virtual const char* getName()const {return "SPHERE";}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ ATTRIBUTE_ALIGNED16( class) btPersistentManifold
|
||||
int m_cachedPoints;
|
||||
|
||||
btScalar m_contactBreakingThreshold;
|
||||
btScalar m_contactProcessingThreshold;
|
||||
|
||||
|
||||
/// sort cached points so most isolated points come first
|
||||
@@ -70,9 +71,10 @@ public:
|
||||
|
||||
btPersistentManifold();
|
||||
|
||||
btPersistentManifold(void* body0,void* body1,int , btScalar contactBreakingThreshold)
|
||||
btPersistentManifold(void* body0,void* body1,int , btScalar contactBreakingThreshold,btScalar contactProcessingThreshold)
|
||||
: m_body0(body0),m_body1(body1),m_cachedPoints(0),
|
||||
m_contactBreakingThreshold(contactBreakingThreshold)
|
||||
m_contactBreakingThreshold(contactBreakingThreshold),
|
||||
m_contactProcessingThreshold(contactProcessingThreshold)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -111,6 +113,11 @@ public:
|
||||
|
||||
///@todo: get this margin from the current physics / collision environment
|
||||
btScalar getContactBreakingThreshold() const;
|
||||
|
||||
btScalar getContactProcessingThreshold() const
|
||||
{
|
||||
return m_contactProcessingThreshold;
|
||||
}
|
||||
|
||||
int getCacheEntry(const btManifoldPoint& newPoint) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user