export contact friction/damping through URDF and API
convert from contact friction/damping to cfm/erp btCollisionObject::setContactFrictionAndDamping
This commit is contained in:
@@ -36,7 +36,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
extern ContactAddedCallback gContactAddedCallback;
|
||||
|
||||
|
||||
MultiBodySoftContact::MultiBodySoftContact(struct GUIHelperInterface* helper)
|
||||
@@ -47,18 +46,7 @@ m_once(true)
|
||||
|
||||
MultiBodySoftContact::~MultiBodySoftContact()
|
||||
{
|
||||
gContactAddedCallback = 0;
|
||||
}
|
||||
|
||||
|
||||
static bool btMultiBodySoftContactCallback(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1)
|
||||
{
|
||||
cp.m_contactCFM = 0.3;
|
||||
cp.m_contactERP = 0.2;
|
||||
cp.m_contactPointFlags |= BT_CONTACT_FLAG_HAS_CONTACT_CFM;
|
||||
cp.m_contactPointFlags |= BT_CONTACT_FLAG_HAS_CONTACT_ERP;
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +54,7 @@ static bool btMultiBodySoftContactCallback(btManifoldPoint& cp, const btCollisio
|
||||
|
||||
void MultiBodySoftContact::initPhysics()
|
||||
{
|
||||
gContactAddedCallback = btMultiBodySoftContactCallback;
|
||||
|
||||
int upAxis = 2;
|
||||
|
||||
m_guiHelper->setUpAxis(upAxis);
|
||||
@@ -109,12 +97,13 @@ void MultiBodySoftContact::initPhysics()
|
||||
start.setOrigin(groundOrigin);
|
||||
// start.setRotation(groundOrn);
|
||||
btRigidBody* body = createRigidBody(0,start,box);
|
||||
|
||||
//setContactStiffnessAndDamping will enable compliant rigid body contact
|
||||
body->setContactStiffnessAndDamping(300,10);
|
||||
btVector4 color = colors[curColor];
|
||||
curColor++;
|
||||
curColor&=3;
|
||||
m_guiHelper->createRigidBodyGraphicsObject(body,color);
|
||||
int flags = body->getCollisionFlags();
|
||||
body->setCollisionFlags(flags|btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user