diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-07-03 09:58:23 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-07-03 09:58:23 +0400 |
commit | 3b1a592fb7a4ce3fb0582bcdf0472eef43b9778c (patch) | |
tree | e750f88902b9cc23c461c8589dfe9bc5b9707d8b /source/gameengine/Ketsji | |
parent | da83509dca485b893aa76511d03a7e3aa8ff8a1f (diff) |
debug lines / register the applied impulse for constraint (for breaking)
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_PyConstraintBinding.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index 28138195a5e..6fbf2888bd9 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -73,6 +73,8 @@ static char gPySetSolverType__doc__[] = "setSolverType(int solverType) Very expe static char gPyCreateConstraint__doc__[] = "createConstraint(ob1,ob2,float restLength,float restitution,float damping)"; static char gPyGetVehicleConstraint__doc__[] = "getVehicleConstraint(int constraintId)"; static char gPyRemoveConstraint__doc__[] = "removeConstraint(int constraintId)"; +static char gPyGetAppliedImpulse__doc__[] = "getAppliedImpulse(int constraintId)"; + @@ -401,6 +403,32 @@ static PyObject* gPyCreateConstraint(PyObject* self, } + + +static PyObject* gPyGetAppliedImpulse(PyObject* self, + PyObject* args, + PyObject* kwds) +{ + float appliedImpulse = 0.f; + +#if defined(_WIN64) + __int64 constraintid; + if (PyArg_ParseTuple(args,"L",&constraintid)) +#else + long constraintid; + if (PyArg_ParseTuple(args,"l",&constraintid)) +#endif + { + if (PHY_GetActiveEnvironment()) + { + appliedImpulse = PHY_GetActiveEnvironment()->getAppliedImpulse(constraintid); + } + } + + return PyFloat_FromDouble(appliedImpulse); +} + + static PyObject* gPyRemoveConstraint(PyObject* self, PyObject* args, PyObject* kwds) @@ -470,6 +498,9 @@ static struct PyMethodDef physicsconstraints_methods[] = { {"removeConstraint",(PyCFunction) gPyRemoveConstraint, METH_VARARGS, gPyRemoveConstraint__doc__}, + {"getAppliedImpulse",(PyCFunction) gPyGetAppliedImpulse, + METH_VARARGS, gPyGetAppliedImpulse__doc__}, + //sentinel { NULL, (PyCFunction) NULL, 0, NULL } |