1 KX_GameObject(SCA_IObject)
2 ==========================
6 base class --- :class:`SCA_IObject`
8 .. class:: KX_GameObject(SCA_IObject)
10 All game objects are derived from this class.
12 Properties assigned to game objects are accessible as attributes of this class.
16 Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError,
17 if an object may have been removed since last accessing it use the :data:`invalid` attribute to check.
19 KX_GameObject can be subclassed to extend functionality. For example:
21 .. code-block:: python
25 class CustomGameObject(bge.types.KX_GameObject):
28 def __init__(self, old_owner):
29 # "old_owner" can just be ignored. At this point, "self" is
30 # already the object in the scene, and "old_owner" has been
33 # New attributes can be defined - but we could also use a game
34 # property, like "self['rate']".
35 self.rate = CustomGameObject.RATE
38 self.worldPosition.z += self.rate
41 if self.worldPosition.z > 1.0:
42 self.rate = -CustomGameObject.RATE
43 elif self.worldPosition.z < 0.0:
44 self.rate = CustomGameObject.RATE
48 old_object = cont.owner
49 mutated_object = CustomGameObject(cont.owner)
51 # After calling the constructor above, references to the old object
53 assert(old_object is not mutated_object)
54 assert(old_object.invalid)
55 assert(mutated_object is cont.owner)
57 # Called later - note we are now working with the mutated object.
61 When subclassing objects other than empties and meshes, the specific type
62 should be used - e.g. inherit from :class:`BL_ArmatureObject` when the object
63 to mutate is an armature.
67 The object's name. (read-only).
79 The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.
81 .. attribute:: isSuspendDynamics
83 The object's dynamic state (read-only).
87 .. seealso:: :py:meth:`suspendDynamics` and :py:meth:`restoreDynamics` allow you to change the state.
89 .. attribute:: linearDamping
91 The object's linear damping, also known as translational damping. Can be set simultaneously with angular damping using the :py:meth:`setDamping` method.
93 :type: float between 0 and 1 inclusive.
97 The object must have a physics controller for the linear damping to be applied, otherwise the value will be returned as 0.0.
99 .. attribute:: angularDamping
101 The object's angular damping, also known as rotationation damping. Can be set simultaneously with linear damping using the :py:meth:`setDamping` method.
103 :type: float between 0 and 1 inclusive.
107 The object must have a physics controller for the angular damping to be applied, otherwise the value will be returned as 0.0.
110 .. attribute:: linVelocityMin
112 Enforces the object keeps moving at a minimum velocity.
118 Applies to dynamic and rigid body objects only.
122 A value of 0.0 disables this option.
126 While objects are stationary the minimum velocity will not be applied.
128 .. attribute:: linVelocityMax
130 Clamp the maximum linear velocity to prevent objects moving beyond a set speed.
136 Applies to dynamic and rigid body objects only.
140 A value of 0.0 disables this option (rather then setting it stationary).
142 .. attribute:: angularVelocityMin
144 Enforces the object keeps rotating at a minimum velocity. A value of 0.0 disables this.
146 :type: non-negative float
150 Applies to dynamic and rigid body objects only.
151 While objects are stationary the minimum velocity will not be applied.
154 .. attribute:: angularVelocityMax
156 Clamp the maximum angular velocity to prevent objects rotating beyond a set speed.
157 A value of 0.0 disables clamping; it does not stop rotation.
159 :type: non-negative float
163 Applies to dynamic and rigid body objects only.
165 .. attribute:: localInertia
167 the object's inertia vector in local coordinates. Read only.
169 :type: Vector((ix, iy, iz))
171 .. attribute:: parent
173 The object's parent object. (read-only).
175 :type: :class:`KX_GameObject` or None
177 .. attribute:: groupMembers
179 Returns the list of group members if the object is a group object (dupli group instance), otherwise None is returned.
181 :type: :class:`CListValue` of :class:`KX_GameObject` or None
183 .. attribute:: groupObject
185 Returns the group object (dupli group instance) that the object belongs to or None if the object is not part of a group.
187 :type: :class:`KX_GameObject` or None
189 .. attribute:: collisionGroup
191 The object's collision group.
195 .. attribute:: collisionMask
197 The object's collision mask.
201 .. attribute:: collisionCallbacks
203 A list of functions to be called when a collision occurs.
205 :type: list of functions and/or methods
207 Callbacks should either accept one argument `(object)`, or three
208 arguments `(object, point, normal)`. For simplicity, per
209 colliding object only the first collision point is reported.
211 .. code-block:: python
214 def callback_three(object, point, normal):
215 print('Hit by %r at %s with normal %s' % (object.name, point, normal))
217 def callback_one(object):
218 print('Hit by %r' % object.name)
220 def register_callback(controller):
221 controller.owner.collisionCallbacks.append(callback_three)
222 controller.owner.collisionCallbacks.append(callback_one)
226 class YourGameEntity(bge.types.KX_GameObject):
227 def __init__(self, old_owner):
228 self.collisionCallbacks.append(self.on_collision_three)
229 self.collisionCallbacks.append(self.on_collision_one)
231 def on_collision_three(self, object, point, normal):
232 print('Hit by %r at %s with normal %s' % (object.name, point, normal))
234 def on_collision_one(self, object):
235 print('Hit by %r' % object.name)
238 For backward compatibility, a callback with variable number of
239 arguments (using `*args`) will be passed only the `object`
240 argument. Only when there is more than one fixed argument (not
241 counting `self` for methods) will the three-argument form be
246 The object's scene. (read-only).
248 :type: :class:`KX_Scene` or None
250 .. attribute:: visible
258 Game logic will still run for invisible objects.
260 .. attribute:: record_animation
262 Record animation for this object.
268 The object color of the object. [r, g, b, a]
270 :type: :class:`mathutils.Vector`
272 .. attribute:: occlusion
274 occlusion capability flag.
278 .. attribute:: position
280 The object's position. [x, y, z] On write: local position, on read: world position
282 .. deprecated:: use :data:`localPosition` and :data:`worldPosition`.
284 :type: :class:`mathutils.Vector`
286 .. attribute:: orientation
288 The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. On write: local orientation, on read: world orientation
290 .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`.
292 :type: :class:`mathutils.Matrix`
294 .. attribute:: scaling
296 The object's scaling factor. [sx, sy, sz] On write: local scaling, on read: world scaling
298 .. deprecated:: use :data:`localScale` and :data:`worldScale`.
300 :type: :class:`mathutils.Vector`
302 .. attribute:: localOrientation
304 The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
306 :type: :class:`mathutils.Matrix`
308 .. attribute:: worldOrientation
310 The object's world orientation. 3x3 Matrix.
312 :type: :class:`mathutils.Matrix`
314 .. attribute:: localScale
316 The object's local scaling factor. [sx, sy, sz]
318 :type: :class:`mathutils.Vector`
320 .. attribute:: worldScale
322 The object's world scaling factor. [sx, sy, sz]
324 :type: :class:`mathutils.Vector`
326 .. attribute:: localPosition
328 The object's local position. [x, y, z]
330 :type: :class:`mathutils.Vector`
332 .. attribute:: worldPosition
334 The object's world position. [x, y, z]
336 :type: :class:`mathutils.Vector`
338 .. attribute:: localTransform
340 The object's local space transform matrix. 4x4 Matrix.
342 :type: :class:`mathutils.Matrix`
344 .. attribute:: worldTransform
346 The object's world space transform matrix. 4x4 Matrix.
348 :type: :class:`mathutils.Matrix`
350 .. attribute:: localLinearVelocity
352 The object's local linear velocity. [x, y, z]
354 :type: :class:`mathutils.Vector`
356 .. attribute:: worldLinearVelocity
358 The object's world linear velocity. [x, y, z]
360 :type: :class:`mathutils.Vector`
362 .. attribute:: localAngularVelocity
364 The object's local angular velocity. [x, y, z]
366 :type: :class:`mathutils.Vector`
368 .. attribute:: worldAngularVelocity
370 The object's world angular velocity. [x, y, z]
372 :type: :class:`mathutils.Vector`
374 .. attribute:: timeOffset
376 adjust the slowparent delay at runtime.
382 the game object's state bitmask, using the first 30 bits, one bit must always be set.
386 .. attribute:: meshes
388 a list meshes for this object.
390 :type: list of :class:`KX_MeshProxy`
394 Most objects use only 1 mesh.
398 Changes to this list will not update the KX_GameObject.
400 .. attribute:: sensors
402 a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support.
408 This attribute is experemental and may be removed (but probably wont be).
412 Changes to this list will not update the KX_GameObject.
414 .. attribute:: controllers
416 a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support.
418 :type: list of :class:`SCA_ISensor`
422 This attribute is experemental and may be removed (but probably wont be).
426 Changes to this list will not update the KX_GameObject.
428 .. attribute:: actuators
430 a list of :class:`SCA_IActuator` with string/index lookups and iterator support.
436 This attribute is experemental and may be removed (but probably wont be).
440 Changes to this list will not update the KX_GameObject.
442 .. attribute:: attrDict
444 get the objects internal python attribute dictionary for direct (faster) access.
448 .. attribute:: children
450 direct children of this object, (read-only).
452 :type: :class:`CListValue` of :class:`KX_GameObject`'s
454 .. attribute:: childrenRecursive
456 all children of this object including childrens children, (read-only).
458 :type: :class:`CListValue` of :class:`KX_GameObject`'s
462 The number of seconds until the object ends, assumes 50fps.
463 (when added with an add object actuator), (read-only).
469 If true, the object's debug properties will be displayed on screen.
473 .. attribute:: debugRecursive
475 If true, the object's and children's debug properties will be displayed on screen.
479 .. attribute:: currentLodLevel
481 The index of the level of detail (LOD) currently used by this object (read-only).
485 .. method:: endObject()
487 Delete this object, can be used in place of the EndObject Actuator.
489 The actual removal of the object from the scene is delayed.
491 .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False)
493 Replace the mesh of this object with a new mesh. This works the same was as the actuator.
495 :arg mesh: mesh to replace or the meshes name.
496 :type mesh: :class:`MeshProxy` or string
497 :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument).
498 :type useDisplayMesh: boolean
499 :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument).
500 :type usePhysicsMesh: boolean
502 .. method:: setVisible(visible, recursive)
504 Sets the game object's visible flag.
506 :arg visible: the visible state to set.
507 :type visible: boolean
508 :arg recursive: optional argument to set all childrens visibility flag too.
509 :type recursive: boolean
511 .. method:: setOcclusion(occlusion, recursive)
513 Sets the game object's occlusion capability.
515 :arg occlusion: the state to set the occlusion to.
516 :type occlusion: boolean
517 :arg recursive: optional argument to set all childrens occlusion flag too.
518 :type recursive: boolean
520 .. method:: alignAxisToVect(vect, axis=2, factor=1.0)
522 Aligns any of the game object's axis along the given vector.
525 :arg vect: a vector to align the axis.
526 :type vect: 3D vector
527 :arg axis: The axis you want to align
534 :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0)
537 .. method:: getAxisVect(vect)
539 Returns the axis vector rotates by the objects worldspace orientation.
540 This is the equivalent of multiplying the vector by the orientation matrix.
542 :arg vect: a vector to align the axis.
543 :type vect: 3D Vector
544 :return: The vector in relation to the objects rotation.
547 .. method:: applyMovement(movement, local=False)
549 Sets the game object's movement.
551 :arg movement: movement vector.
552 :type movement: 3D Vector
554 * False: you get the "global" movement ie: relative to world orientation.
555 * True: you get the "local" movement ie: relative to object orientation.
558 .. method:: applyRotation(rotation, local=False)
560 Sets the game object's rotation.
562 :arg rotation: rotation vector.
563 :type rotation: 3D Vector
565 * False: you get the "global" rotation ie: relative to world orientation.
566 * True: you get the "local" rotation ie: relative to object orientation.
569 .. method:: applyForce(force, local=False)
571 Sets the game object's force.
573 This requires a dynamic object.
575 :arg force: force vector.
576 :type force: 3D Vector
578 * False: you get the "global" force ie: relative to world orientation.
579 * True: you get the "local" force ie: relative to object orientation.
582 .. method:: applyTorque(torque, local=False)
584 Sets the game object's torque.
586 This requires a dynamic object.
588 :arg torque: torque vector.
589 :type torque: 3D Vector
591 * False: you get the "global" torque ie: relative to world orientation.
592 * True: you get the "local" torque ie: relative to object orientation.
595 .. method:: getLinearVelocity(local=False)
597 Gets the game object's linear velocity.
599 This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
602 * False: you get the "global" velocity ie: relative to world orientation.
603 * True: you get the "local" velocity ie: relative to object orientation.
605 :return: the object's linear velocity.
606 :rtype: Vector((vx, vy, vz))
608 .. method:: setLinearVelocity(velocity, local=False)
610 Sets the game object's linear velocity.
612 This method sets game object's velocity through it's centre of mass,
613 ie no angular velocity component.
615 This requires a dynamic object.
617 :arg velocity: linear velocity vector.
618 :type velocity: 3D Vector
620 * False: you get the "global" velocity ie: relative to world orientation.
621 * True: you get the "local" velocity ie: relative to object orientation.
624 .. method:: getAngularVelocity(local=False)
626 Gets the game object's angular velocity.
629 * False: you get the "global" velocity ie: relative to world orientation.
630 * True: you get the "local" velocity ie: relative to object orientation.
632 :return: the object's angular velocity.
633 :rtype: Vector((vx, vy, vz))
635 .. method:: setAngularVelocity(velocity, local=False)
637 Sets the game object's angular velocity.
639 This requires a dynamic object.
641 :arg velocity: angular velocity vector.
642 :type velocity: boolean
644 * False: you get the "global" velocity ie: relative to world orientation.
645 * True: you get the "local" velocity ie: relative to object orientation.
647 .. method:: getVelocity(point=(0, 0, 0))
649 Gets the game object's velocity at the specified point.
651 Gets the game object's velocity at the specified point, including angular
654 :arg point: optional point to return the velocity for, in local coordinates.
655 :type point: 3D Vector
656 :return: the velocity at the specified point.
657 :rtype: Vector((vx, vy, vz))
659 .. method:: getReactionForce()
661 Gets the game object's reaction force.
663 The reaction force is the force applied to this object over the last simulation timestep.
664 This also includes impulses, eg from collisions.
666 :return: the reaction force of this object.
667 :rtype: Vector((fx, fy, fz))
671 This is not implimented at the moment.
673 .. method:: applyImpulse(point, impulse, local=False)
675 Applies an impulse to the game object.
677 This will apply the specified impulse to the game object at the specified point.
678 If point != position, applyImpulse will also change the object's angular momentum.
679 Otherwise, only linear momentum will change.
681 :arg point: the point to apply the impulse to (in world or local coordinates)
682 :type point: point [ix, iy, iz] the point to apply the impulse to (in world or local coordinates)
683 :arg impulse: impulse vector.
684 :type impulse: 3D Vector
686 * False: you get the "global" impulse ie: relative to world coordinates with world orientation.
687 * True: you get the "local" impulse ie: relative to local coordinates with object orientation.
690 .. method:: setDamping(linear_damping, angular_damping)
692 Sets both the :py:attr:`linearDamping` and :py:attr:`angularDamping` simultaneously. This is more efficient than setting both properties individually.
694 :arg linear_damping: Linear ("translational") damping factor.
695 :type linear_damping: float ∈ [0, 1]
696 :arg angular_damping: Angular ("rotational") damping factor.
697 :type angular_damping: float ∈ [0, 1]
699 .. method:: suspendDynamics([ghost])
701 Suspends physics for this object.
703 :arg ghost: When set to `True`, collisions with the object will be ignored, similar to the "ghost" checkbox in
704 Blender. When `False` (the default), the object becomes static but still collide with other objects.
707 .. seealso:: :py:attr:`isSuspendDynamics` allows you to inspect whether the object is in a suspended state.
709 .. method:: restoreDynamics()
711 Resumes physics for this object. Also reinstates collisions; the object will no longer be a ghost.
715 The objects linear velocity will be applied from when the dynamics were suspended.
717 .. method:: enableRigidBody()
719 Enables rigid body physics for this object.
721 Rigid body physics allows the object to roll on collisions.
723 .. method:: disableRigidBody()
725 Disables rigid body physics for this object.
727 .. method:: setParent(parent, compound=True, ghost=True)
729 Sets this object's parent.
730 Control the shape status with the optional compound and ghost parameters:
732 In that case you can control if it should be ghost or not:
734 :arg parent: new parent object.
735 :type parent: :class:`KX_GameObject`
736 :arg compound: whether the shape should be added to the parent compound shape.
738 * True: the object shape should be added to the parent compound shape.
739 * False: the object should keep its individual shape.
741 :type compound: boolean
742 :arg ghost: whether the object should be ghost while parented.
744 * True: if the object should be made ghost while parented.
745 * False: if the object should be solid while parented.
751 If the object type is sensor, it stays ghost regardless of ghost parameter
753 .. method:: removeParent()
755 Removes this objects parent.
757 .. method:: getPhysicsId()
759 Returns the user data object associated with this game object's physics controller.
761 .. method:: getPropertyNames()
763 Gets a list of all property names.
765 :return: All property names for this object.
768 .. method:: getDistanceTo(other)
770 :arg other: a point or another :class:`KX_GameObject` to measure the distance to.
771 :type other: :class:`KX_GameObject` or list [x, y, z]
772 :return: distance to another object or point.
775 .. method:: getVectTo(other)
777 Returns the vector and the distance to another object or point.
778 The vector is normalized unless the distance is 0, in which a zero length vector is returned.
780 :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to.
781 :type other: :class:`KX_GameObject` or list [x, y, z]
782 :return: (distance, globalVector(3), localVector(3))
783 :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z))
785 .. method:: rayCastTo(other, dist, prop)
787 Look towards another point/object and find first object hit within dist that matches prop.
789 The ray is always casted from the center of the object, ignoring the object itself.
790 The ray is casted towards the center of another object or an explicit [x, y, z] point.
791 Use rayCast() if you need to retrieve the hit point
793 :arg other: [x, y, z] or object towards which the ray is casted
794 :type other: :class:`KX_GameObject` or 3-tuple
795 :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
797 :arg prop: property name that object must have; can be omitted => detect any object
799 :return: the first object hit or None if no object or object does not match prop
800 :rtype: :class:`KX_GameObject`
802 .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly)
804 Look from a point/object to another point/object and find first object hit within dist that matches prop.
805 if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit.
806 if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element.
807 if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element.
809 .. code-block:: python
811 # shoot along the axis gun-gunAim (gunAim should be collision-free)
812 obj, point, normal = gun.rayCast(gunAim, None, 50)
817 The face paremeter determines the orientation of the normal.
819 * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
820 * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
822 The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
823 The prop and xray parameters interact as follow.
825 * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
826 * prop off, xray on : idem.
827 * prop on, xray off: return closest hit if it matches prop, no hit otherwise.
828 * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
830 The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray.
831 If there is no hit or the hit object is not a static mesh, None is returned as 4th element.
833 The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
835 :arg objto: [x, y, z] or object to which the ray is casted
836 :type objto: :class:`KX_GameObject` or 3-tuple
837 :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center
838 :type objfrom: :class:`KX_GameObject` or 3-tuple or None
839 :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to
841 :arg prop: property name that object must have; can be omitted or "" => detect any object
843 :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin
845 :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object
847 :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit.
849 * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit
850 * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape.
851 * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping.
854 :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv).
856 * object, hitpoint and hitnormal are None if no hit.
857 * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None
858 * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None
862 * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz))
863 * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`KX_PolyProxy`)
864 * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`KX_PolyProxy`, 2-tuple (u, v))
868 The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points.
870 .. method:: setCollisionMargin(margin)
872 Set the objects collision margin.
874 :arg margin: the collision margin distance in blender units.
879 If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError.
881 .. method:: sendMessage(subject, body="", to="")
885 :arg subject: The subject of the message
886 :type subject: string
887 :arg body: The body of the message (optional)
889 :arg to: The name of the object to send the message to (optional)
892 .. method:: reinstancePhysicsMesh(gameObject, meshObject)
894 Updates the physics system with the changed mesh.
896 If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object.
898 :arg gameObject: optional argument, set the physics shape from this gameObjets mesh.
899 :type gameObject: string, :class:`KX_GameObject` or None
900 :arg meshObject: optional argument, set the physics shape from this mesh.
901 :type meshObject: string, :class:`MeshProxy` or None
903 :return: True if reinstance succeeded, False if it failed.
908 If this object has instances the other instances will be updated too.
912 The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
916 Only triangle mesh type objects are supported currently (not convex hull)
920 If the object is a part of a combound object it will fail (parent or child)
924 Rebuilding the physics mesh can be slow, running many times per second will give a performance hit.
926 .. method:: get(key, default=None)
928 Return the value matching key, or the default value if its not found.
929 :return: The key value or a default.
931 .. method:: playAction(name, start_frame, end_frame, layer=0, priority=0, blendin=0, play_mode=KX_ACTION_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0, blend_mode=KX_ACTION_BLEND_BLEND)
935 :arg name: the name of the action
937 :arg start: the start frame of the action
939 :arg end: the end frame of the action
941 :arg layer: the layer the action will play in (actions in different layers are added/blended together)
943 :arg priority: only play this action if there isn't an action currently playing in this layer with a higher (lower number) priority
944 :type priority: integer
945 :arg blendin: the amount of blending between this animation and the previous one on this layer
947 :arg play_mode: the play mode
948 :type play_mode: one of :ref:`these constants <gameobject-playaction-mode>`
949 :arg layer_weight: how much of the previous layer to use for blending
950 :type layer_weight: float
951 :arg ipo_flags: flags for the old IPO behaviors (force, etc)
952 :type ipo_flags: int bitfield
953 :arg speed: the playback speed of the action as a factor (1.0 = normal speed, 2.0 = 2x speed, etc)
955 :arg blend_mode: how to blend this layer with previous layers
956 :type blend_mode: one of :ref:`these constants <gameobject-playaction-blend>`
958 .. method:: stopAction(layer=0)
960 Stop playing the action on the given layer.
962 :arg layer: The layer to stop playing.
965 .. method:: getActionFrame(layer=0)
967 Gets the current frame of the action playing in the supplied layer.
969 :arg layer: The layer that you want to get the frame from.
972 :return: The current frame of the action
975 .. method:: getActionName(layer=0)
977 Gets the name of the current action playing in the supplied layer.
979 :arg layer: The layer that you want to get the action name from.
982 :return: The name of the current action
985 .. method:: setActionFrame(frame, layer=0)
987 Set the current frame of the action playing in the supplied layer.
989 :arg layer: The layer where you want to set the frame
991 :arg frame: The frame to set the action to
994 .. method:: isPlayingAction(layer=0)
996 Checks to see if there is an action playing in the given layer.
998 :arg layer: The layer to check for a playing action.
1001 :return: Whether or not the action is playing
1004 .. method:: addDebugProperty (name, debug = True)
1006 Adds a single debug property to the debug list.
1008 :arg name: name of the property that added to the debug list.
1010 :arg debug: the debug state.
1011 :type debug: boolean