BGE : Fix Bullet shape margin for triangle mesh static objects
This commit is contained in:
parent
615a7aea55
commit
909d3228b1
Notes:
blender-bot
2023-02-14 08:26:30 +01:00
Referenced by issue #46752, Collision between convex hull and triangle mesh causing slow fps in bge
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue