2 # Documentation for KX_SCA_AddObjectActuator
3 from SCA_IActuator import *
5 class KX_SCA_AddObjectActuator(SCA_IActuator):
7 Edit Object Actuator (in Add Object Mode)
8 @ivar object: the object this actuator adds.
9 @type object: KX_GameObject or None
10 @ivar objectLastCreated: the last added object from this actuator (read only).
11 @type objectLastCreated: KX_GameObject or None
12 @ivar time: the lifetime of added objects, in frames.
14 @ivar linearVelocity: the initial linear velocity of added objects.
15 @type linearVelocity: list [vx, vy, vz]
16 @ivar angularVelocity: the initial angular velocity of added objects.
17 @type angularVelocity: list [vx, vy, vz]
19 @warning: An Add Object actuator will be ignored if at game start, the linked object doesn't exist
20 (or is empty) or the linked object is in an active layer.
22 This will genereate a warning in the console:
24 C{ERROR: GameObject I{OBName} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)}
26 def setObject(object):
28 DEPRECATED: use the object property
29 Sets the game object to add.
31 A copy of the object will be added to the scene when the actuator is activated.
33 If the object does not exist, this function is ignored.
35 object can either be a L{KX_GameObject} or the name of an object or None.
37 @type object: L{KX_GameObject}, string or None
39 def getObject(name_only = 0):
41 DEPRECATED: use the object property
42 Returns the name of the game object to be added.
44 Returns None if no game object has been assigned to be added.
46 @param name_only: optional argument, when 0 return a KX_GameObject
47 @rtype: string, KX_GameObject or None if no object is set
51 DEPRECATED: use the time property
52 Sets the lifetime of added objects, in frames.
54 If time == 0, the object will last forever.
57 @param time: The minimum value for time is 0.
61 DEPRECATED: use the time property
62 Returns the lifetime of the added object, in frames.
66 def setLinearVelocity(vx, vy, vz):
68 DEPRECATED: use the linearVelocity property
69 Sets the initial linear velocity of added objects.
72 @param vx: the x component of the initial linear velocity.
74 @param vy: the y component of the initial linear velocity.
76 @param vz: the z component of the initial linear velocity.
78 def getLinearVelocity():
80 DEPRECATED: use the linearVelocity property
81 Returns the initial linear velocity of added objects.
83 @rtype: list [vx, vy, vz]
85 def setAngularVelocity(vx, vy, vz):
87 DEPRECATED: use the angularVelocity property
88 Sets the initial angular velocity of added objects.
91 @param vx: the x component of the initial angular velocity.
93 @param vy: the y component of the initial angular velocity.
95 @param vz: the z component of the initial angular velocity.
97 def getAngularVelocity():
99 DEPRECATED: use the angularVelocity property
100 Returns the initial angular velocity of added objects.
102 @rtype: list [vx, vy, vz]
104 def getLastCreatedObject():
106 DEPRECATED: use the objectLastCreated property
107 Returns the last object created by this actuator.
109 @rtype: L{KX_GameObject}
110 @return: A L{KX_GameObject} or None if no object has been created.