diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-04-06 22:30:52 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-04-06 22:30:52 +0400 |
commit | e7384c9dd2d93e3814e8df51eea64f1dc687c338 (patch) | |
tree | 44fb5c808bb3af0783c675886e029e9e4bdb1a21 /source/gameengine/PyDoc | |
parent | 711306c2ba1c4ea0d0027087ce53746cde4be0ed (diff) |
Commit patch #8799: Realtime SetParent function in the BGE
This patch consists in new KX_GameObject::SetParent() and KX_GameObject::RemoveParent() functions to create and destroy parent relation during game. These functions are accessible through python and through a new actuator KX_ParentActuator. Function documentation in PyDoc.
The object keeps its orientation, position and scale when it is parented but will further rotate, move and scale with its parent from that point on. When the parent relation is broken, the object keeps the orientation, position and scale it had at that time.
The function has no effect if any of the X/Y/Z scale of the object or its new parent are below Epsilon.
Diffstat (limited to 'source/gameengine/PyDoc')
-rw-r--r-- | source/gameengine/PyDoc/KX_GameObject.py | 8 | ||||
-rw-r--r-- | source/gameengine/PyDoc/KX_ParentActuator.py | 22 |
2 files changed, 30 insertions, 0 deletions
diff --git a/source/gameengine/PyDoc/KX_GameObject.py b/source/gameengine/PyDoc/KX_GameObject.py index d3428915f25..7ed4b59629c 100644 --- a/source/gameengine/PyDoc/KX_GameObject.py +++ b/source/gameengine/PyDoc/KX_GameObject.py @@ -135,6 +135,14 @@ class KX_GameObject: @rtype: L{KX_GameObject} @return: this object's parent object, or None if this object has no parent. """ + def setParent(parent): + """ + Sets this object's parent. + """ + def removeParent(): + """ + Removes this objects parent. + """ def getMesh(mesh): """ Gets the mesh object for this object. diff --git a/source/gameengine/PyDoc/KX_ParentActuator.py b/source/gameengine/PyDoc/KX_ParentActuator.py new file mode 100644 index 00000000000..f45bb5d20b1 --- /dev/null +++ b/source/gameengine/PyDoc/KX_ParentActuator.py @@ -0,0 +1,22 @@ +# $Id: KX_ParentActuator.py 2615 2004-06-02 12:43:27Z kester $ +# Documentation for KX_ParentActuator +from SCA_IActuator import * + +class KX_ParentActuator(SCA_IActuator): + """ + The parent actuator can set or remove an objects parent object. + """ + def setObject(object): + """ + Sets the object to set as parent. + + Object can be either a L{KX_GameObject} or the name of the object. + + @type object: L{KX_GameObject} or string + """ + def getObject(): + """ + Returns the name of the object to change to. + + @rtype: string + """ |