diff options
Diffstat (limited to 'source/gameengine/Physics/Bullet/CcdPhysicsController.h')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h index a1245f6a3e9..054ec91122a 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h @@ -413,8 +413,29 @@ class CcdPhysicsController : public PHY_IPhysicsController } virtual void calcXform() {} ; - virtual void SetMargin(float margin) {}; - virtual float GetMargin() const {return 0.f;}; + virtual void SetMargin(float margin) + { + if (m_collisionShape) + m_collisionShape->setMargin(btScalar(margin)); + } + virtual float GetMargin() const + { + return (m_collisionShape) ? m_collisionShape->getMargin() : 0.f; + } + virtual float GetRadius() const + { + // this is not the actual shape radius, it's only used for Fh support + return m_cci.m_radius; + } + virtual void SetRadius(float margin) + { + if (m_collisionShape && m_collisionShape->getShapeType() == SPHERE_SHAPE_PROXYTYPE) + { + btSphereShape* sphereShape = static_cast<btSphereShape*>(m_collisionShape); + sphereShape->setUnscaledRadius(margin); + } + m_cci.m_radius = margin; + } bool wantsSleeping(); |