BGE : Fix Bullet shape margin for triangle mesh static objects
This commit is contained in:
@@ -2610,6 +2610,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b
|
||||
}
|
||||
|
||||
btBvhTriangleMeshShape *unscaledShape = new btBvhTriangleMeshShape(m_triangleIndexVertexArray, true, useBvh);
|
||||
unscaledShape->setMargin(margin);
|
||||
collisionShape = new btScaledBvhTriangleMeshShape(unscaledShape, btVector3(1.0f, 1.0f, 1.0f));
|
||||
collisionShape->setMargin(margin);
|
||||
}
|
||||
|
@@ -657,8 +657,12 @@ protected:
|
||||
virtual void CalcXform() {}
|
||||
virtual void SetMargin(float margin)
|
||||
{
|
||||
if (m_collisionShape)
|
||||
m_collisionShape->setMargin(btScalar(margin));
|
||||
if (m_collisionShape) {
|
||||
m_collisionShape->setMargin(margin);
|
||||
// if the shape use a unscaled shape we have also to set the correct margin in it
|
||||
if (m_collisionShape->getShapeType() == SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE)
|
||||
((btScaledBvhTriangleMeshShape *)m_collisionShape)->getChildShape()->setMargin(margin);
|
||||
}
|
||||
}
|
||||
virtual float GetMargin() const
|
||||
{
|
||||
|
Reference in New Issue
Block a user