diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-07-26 02:57:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-07-26 02:57:29 +0400 |
commit | e9ca43521f99c6b9baf6d9278f85323086fcade2 (patch) | |
tree | 58ab9f5afe70d77fa04f920fa2c55adb34cd2990 /source/gameengine/PyDoc/GameTypes.py | |
parent | 1c00eacca2b084d7189de33cb75e8612cb542030 (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/PyDoc/GameTypes.py')
-rw-r--r-- | source/gameengine/PyDoc/GameTypes.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py index 35d8cd63c44..6a554a7c42e 100644 --- a/source/gameengine/PyDoc/GameTypes.py +++ b/source/gameengine/PyDoc/GameTypes.py @@ -2078,6 +2078,26 @@ class KX_GameObject(SCA_IObject): @param to: The name of the object to send the message to (optional) @type to: string """ + def reinstancePhysicsMesh(gameObject, meshObject): + """ + Updates the physics system with the changed mesh. + + If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object. + + @param gameObject: optional argument, set the physics shape from this gameObjets mesh. + @type gameObject: string, L{KX_GameObject} or None + @param meshObject: optional argument, set the physics shape from this mesh. + @type meshObject: string, L{KX_MeshProxy} or None + + @note: if this object has instances the other instances will be updated too. + @note: the gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf). + @warning: only triangle mesh type objects are supported currently (not convex hull) + @warning: if the object is a part of a combound object it will fail (parent or child) + @warning: rebuilding the physics mesh can be slow, running many times per second will give a performance hit. + @rtype: boolean + @return: True if reinstance succeeded, False if it failed. + """ + def get(key, default=None): """ Return the value matching key, or the default value if its not found. @@ -2387,18 +2407,6 @@ class KX_MeshProxy(SCA_IObject): @rtype: L{KX_PolyProxy} @return: a polygon object. """ - def reinstancePhysicsMesh(): - """ - Updates the physics system with the changed mesh. - - A mesh must have only one material with collision flags, - and have all collision primitives in one vertex array (ie. < 65535 verts) and - be either a polytope or polyheder mesh. If you don't get a warning in the - console when the collision type is polytope, the mesh is suitable for reinstance. - @bug: This currently does not work. - @rtype: boolean - @return: True if reinstance succeeded, False if it failed. - """ class SCA_MouseSensor(SCA_ISensor): """ |