Blender Git Loki

Git Commits -> Revision 06a7155

Revision 06a7155 by Benoit Bolsee (master)
May 21, 2009, 13:32 (GMT)
BGE: user control to compound shape and setParent.

Compound shape control
======================
1) GUI control
It is now possible to control which child shape is added to
a parent compound shape in the Physics buttons. The "Compound"
shape button becomes "Add to parent" on child objects and
determines whether the child shape is to be added to the top
parent compound shape when the game is stated.

Notes: * "Compound" is only available to top parent objects
(objects without parent).
* Nesting of compound shape is not possible: a child
object with "Add to parent" button set will be added
to the top parent compound shape, regardless of its
position in the parent-child hierarchy and even if its
immediate parent doesn't have the "Add to parent" button set.

2) runtime control
It is now possible to control the compound shape at runtime:
The SetParent actuator has a new "Compound" button that indicates
whether the object shape should be added to the compound shape
of the parent object, provided the parent has a compound shape
of course. If not, the object retain it's individual state
while parented.
Similarly, the KX_GameObject.setParent() python function has
a new compound parameter.

Notes: * When an object is dynamically added to a compound
shape, it looses temporarily all its physics capability
to the benefit of the parent: it cannot register collisions
and the characteristics of its shape are lost (ghost, sensor,
dynamic, etc.).
* Nested compound shape is not supported: if the object
being parented is already a compound shape, it is not
added to the compound parent (as if the Compound option
was not set in the actuator or the setParent function).
* To ensure compatibility with old blend files, the Blender
subversion is changed to 2.48.5 and the old blend files
are automatically converted to match the old behavior:
all children of a Compound object will have the "Add to
parent" button set automatically.

Child ghost control
===================
It is now possible to control if an object should becomes ghost
or solid when parented. This is only applicable if the object
is not added to the parent compound shape (see above).
A new "Ghost" button is available on the SetParent actuator to
that effect. Similarly the KX_GameObject.setParent() python function
has a new compound parameter.

Notes: * This option is not applicable to sensor objects: they stay
ghost all the time.
* Make sure the child object does not enter in collision with
the parent shape when the Ghost option if off and the parent is
dynamic: the collision creates a reaction force but the parent
cannot escape the child, so the force builds up and produces
eratic movements.
* The collision capability of an ordinary object (dynamic or static)
is limited when it is parented: it becomes automatically static
and can only detect dynamic and sensor objects.
* A sensor object retain its full collision capability when parented:
it can detect static and dynamic object.

Python control
==============
KX_GameObject.setParent(parent,compound,ghost):
Sets this object's parent.
Control the shape status with the optional compound and ghost parameters:
compound=1: the object shape should be added to the parent compound shape (default)
compound=0: the object should keep its individual shape.
In that case you can control if it should be ghost or not:
ghost=1 if the object should be made ghost while parented (default)
ghost=0 if the object should be solid while parented
Note: if the object type is sensor, it stays ghost regardless of ghost parameter

parent: KX_GameObject reference or string (object name w/o OB prefix)

Commit Details:

Full Hash: 06a7155b681cdb02c6b75b9934f9235efcc6c297
SVN Revision: 20315
Parent Commit: 5fc6afe
Lines Changed: +120, -53

12 Modified Paths:

/source/blender/blenkernel/BKE_blender.h (+1, -1) (Diff)
/source/blender/blenloader/intern/readfile.c (+16, -0) (Diff)
/source/blender/makesdna/DNA_actuator_types.h (+7, -1) (Diff)
/source/blender/src/buttons_logic.c (+21, -5) (Diff)
/source/gameengine/Converter/BL_BlenderDataConversion.cpp (+4, -3) (Diff)
/source/gameengine/Converter/KX_ConvertActuators.cpp (+6, -0) (Diff)
/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp (+18, -30) (Diff)
/source/gameengine/Ketsji/KX_GameObject.cpp (+13, -8) (Diff)
/source/gameengine/Ketsji/KX_GameObject.h (+2, -2) (Diff)
/source/gameengine/Ketsji/KX_ParentActuator.cpp (+7, -1) (Diff)
/source/gameengine/Ketsji/KX_ParentActuator.h (+5, -0) (Diff)
/source/gameengine/PyDoc/GameTypes.py (+20, -2) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021