Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-07-26 02:57:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-26 02:57:29 +0400
commite9ca43521f99c6b9baf6d9278f85323086fcade2 (patch)
tree58ab9f5afe70d77fa04f920fa2c55adb34cd2990 /source/gameengine/Ketsji/KX_GameObject.cpp
parent1c00eacca2b084d7189de33cb75e8612cb542030 (diff)
BGE Physics
Add support back for reinstancePhysics mesh, a frequently requested feature in the BGE forums. from what I can tell Sumo supported this but bullet never did. Currently only accessible via python at the moment. - rigid body, dynamic, static types work. - instanced physics meshes are modified too. - compound shapes are not supported. Physics mesh can be re-instanced from... * shape keys & armature deformations * subsurf (any other modifiers too) * RAS_TexVert's (can be modified from python) Moved the reinstancePhysicsMesh functions from RAS_MeshObject into KX_GameObject since the physics data is stored here. video and blend file demo. http://www.graphicall.org/ftp/ideasman42/reinstance.ogv http://www.graphicall.org/ftp/ideasman42/reinstance_demo.blend
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index b266095c715..36a9efe5b91 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -66,6 +66,7 @@ typedef unsigned long uint_ptr;
#include "KX_PythonInit.h"
#include "KX_PyMath.h"
#include "KX_PythonSeq.h"
+#include "KX_ConvertPhysicsObject.h"
#include "SCA_IActuator.h"
#include "SCA_ISensor.h"
#include "SCA_IController.h"
@@ -1183,6 +1184,7 @@ PyMethodDef KX_GameObject::Methods[] = {
{"getPropertyNames", (PyCFunction)KX_GameObject::sPyGetPropertyNames,METH_NOARGS},
{"replaceMesh",(PyCFunction) KX_GameObject::sPyReplaceMesh, METH_O},
{"endObject",(PyCFunction) KX_GameObject::sPyEndObject, METH_NOARGS},
+ {"reinstancePhysicsMesh", (PyCFunction)KX_GameObject::sPyReinstancePhysicsMesh,METH_VARARGS},
KX_PYMETHODTABLE(KX_GameObject, rayCastTo),
KX_PYMETHODTABLE(KX_GameObject, rayCast),
@@ -1280,6 +1282,28 @@ PyObject* KX_GameObject::PyEndObject()
}
+PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args)
+{
+ KX_GameObject *gameobj= NULL;
+ RAS_MeshObject *mesh= NULL;
+
+ PyObject *gameobj_py= NULL;
+ PyObject *mesh_py= NULL;
+
+ if ( !PyArg_ParseTuple(args,"|OO:reinstancePhysicsMesh",&gameobj_py, &mesh_py) ||
+ (gameobj_py && !ConvertPythonToGameObject(gameobj_py, &gameobj, true, "gameOb.reinstancePhysicsMesh(obj, mesh): KX_GameObject")) ||
+ (mesh_py && !ConvertPythonToMesh(mesh_py, &mesh, true, "gameOb.reinstancePhysicsMesh(obj, mesh): KX_GameObject"))
+ ) {
+ return NULL;
+ }
+
+ /* gameobj and mesh can be NULL */
+ if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh))
+ Py_RETURN_TRUE;
+
+ Py_RETURN_FALSE;
+}
+
PyObject* KX_GameObject::PyGetPosition()
{