diff options
Diffstat (limited to 'source/gameengine/Ketsji')
7 files changed, 38 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp index e0ec09ffdd5..c974b9b6828 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp @@ -15,6 +15,7 @@ #include "PHY_IPhysicsEnvironment.h" + KX_BulletPhysicsController::KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna) : KX_IPhysicsController(dyna,(PHY_IPhysicsController*)this), CcdPhysicsController(ci) @@ -58,6 +59,10 @@ void KX_BulletPhysicsController::SetObject (SG_IObject* object) } +void KX_BulletPhysicsController::SetMargin (float collisionMargin) +{ + CcdPhysicsController::SetMargin(collisionMargin); +} void KX_BulletPhysicsController::RelativeTranslate(const MT_Vector3& dloc,bool local) { CcdPhysicsController::RelativeTranslate(dloc[0],dloc[1],dloc[2],local); diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h index 2251c3b1f90..272868459d0 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h @@ -19,7 +19,7 @@ public: virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse); virtual void SetObject (SG_IObject* object); - + virtual void SetMargin (float collisionMargin); virtual void RelativeTranslate(const MT_Vector3& dloc,bool local); virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local); virtual void ApplyTorque(const MT_Vector3& torque,bool local); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 3b1e4f7ce59..6e53cb4d25f 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -627,6 +627,7 @@ PyMethodDef KX_GameObject::Methods[] = { {"getMass", (PyCFunction) KX_GameObject::sPyGetMass, METH_VARARGS}, {"getReactionForce", (PyCFunction) KX_GameObject::sPyGetReactionForce, METH_VARARGS}, {"applyImpulse", (PyCFunction) KX_GameObject::sPyApplyImpulse, METH_VARARGS}, + {"setCollisionMargin", (PyCFunction) KX_GameObject::sPySetCollisionMargin, METH_VARARGS}, {"suspendDynamics", (PyCFunction)KX_GameObject::sPySuspendDynamics,METH_VARARGS}, {"restoreDynamics", (PyCFunction)KX_GameObject::sPyRestoreDynamics,METH_VARARGS}, {"enableRigidBody", (PyCFunction)KX_GameObject::sPyEnableRigidBody,METH_VARARGS}, @@ -979,6 +980,29 @@ PyObject* KX_GameObject::PyGetMesh(PyObject* self, } + + + +PyObject* KX_GameObject::PySetCollisionMargin(PyObject* self, + PyObject* args, + PyObject* kwds) +{ + float collisionMargin; + if (PyArg_ParseTuple(args, "f", &collisionMargin)) + { + if (m_pPhysicsController1) + { + m_pPhysicsController1->SetMargin(collisionMargin); + Py_Return; + } + + } + + return NULL; +} + + + PyObject* KX_GameObject::PyApplyImpulse(PyObject* self, PyObject* args, PyObject* kwds) diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 0b65109cb8d..f3bf529a37d 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -604,6 +604,7 @@ public: KX_PYMETHOD(KX_GameObject,EnableRigidBody); KX_PYMETHOD(KX_GameObject,DisableRigidBody); KX_PYMETHOD(KX_GameObject,ApplyImpulse); + KX_PYMETHOD(KX_GameObject,SetCollisionMargin); KX_PYMETHOD(KX_GameObject,GetMesh); KX_PYMETHOD(KX_GameObject,GetParent); KX_PYMETHOD(KX_GameObject,GetPhysicsId); diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.h b/source/gameengine/Ketsji/KX_IPhysicsController.h index ca64888fd55..9a64be7f99c 100644 --- a/source/gameengine/Ketsji/KX_IPhysicsController.h +++ b/source/gameengine/Ketsji/KX_IPhysicsController.h @@ -60,6 +60,7 @@ public: virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse)=0; virtual void SetObject (SG_IObject* object)=0; + virtual void SetMargin (float collisionMargin)=0; virtual void RelativeTranslate(const MT_Vector3& dloc,bool local)=0; virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local)=0; diff --git a/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp b/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp index 11a09a12e1e..d042a302eda 100644 --- a/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_SumoPhysicsController.cpp @@ -164,6 +164,11 @@ gameobj->SetPhysicsController(this,gameobj->IsDynamic()); GetSumoObject()->setClientObject(gameobj->getClientInfo()); } +void KX_SumoPhysicsController::SetMargin(float collisionMargin) +{ + SumoPhysicsController::SetMargin(collisionMargin); +} + void KX_SumoPhysicsController::setOrientation(const MT_Quaternion& orn) { diff --git a/source/gameengine/Ketsji/KX_SumoPhysicsController.h b/source/gameengine/Ketsji/KX_SumoPhysicsController.h index b4b0f8a4cd0..ea803d964c8 100644 --- a/source/gameengine/Ketsji/KX_SumoPhysicsController.h +++ b/source/gameengine/Ketsji/KX_SumoPhysicsController.h @@ -64,7 +64,7 @@ public: void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse); virtual void SetObject (SG_IObject* object); - + virtual void SetMargin (float collisionMargin); void RelativeTranslate(const MT_Vector3& dloc,bool local); void RelativeRotate(const MT_Matrix3x3& drot,bool local); |