Module KX_SCA_AddObjectActuator :: Class KX_SCA_AddObjectActuator

Class KX_SCA_AddObjectActuator

source code

SCA_ILogicBrick.SCA_ILogicBrick --+    
                                  |    
        SCA_IActuator.SCA_IActuator --+
                                      |
                                     KX_SCA_AddObjectActuator

Edit Object Actuator (in Add Object Mode)


Warning:

An Add Object actuator will be ignored if at game start, the linked object doesn't exist (or is empty) or the linked object is in an active layer.

This will genereate a warning in the console:

ERROR: GameObject OBName has a AddObjectActuator ActuatorName without object (in 'nonactive' layer)

Instance Methods
 
setObject(obj)
Sets the game object to add.
source code
string
getObject()
Returns the name of the game object to be added.
source code
 
setTime(time)
Sets the lifetime of added objects, in frames.
source code
integer
getTime()
Returns the lifetime of the added object, in frames.
source code
 
setLinearVelocity(vx, vy, vz)
Sets the initial linear velocity of added objects.
source code
list [vx, vy, vz]
getLinearVelocity()
Returns the initial linear velocity of added objects.
source code
KX_GameObject
getLastCreatedObject()
Returns the last object created by this actuator.
source code

Inherited from SCA_ILogicBrick.SCA_ILogicBrick: getExecutePriority, getOwner, setExecutePriority

Method Details

setObject(obj)

source code 

Sets the game object to add.

A copy of the object will be added to the scene when the actuator is activated.

If the object does not exist, this function is ignored.

obj can either be a KX_GameObject or the name of an object.

getObject()

source code 

Returns the name of the game object to be added.

Returns None if no game object has been assigned to be added.
Returns: string

setTime(time)

source code 

Sets the lifetime of added objects, in frames.

If time == 0, the object will last forever.
Parameters:
  • time (integer) - The minimum value for time is 0.

setLinearVelocity(vx, vy, vz)

source code 
Sets the initial linear velocity of added objects.
Parameters:
  • vx (float) - the x component of the initial linear velocity.
  • vy (float) - the y component of the initial linear velocity.
  • vz (float) - the z component of the initial linear velocity.

getLastCreatedObject()

source code 
Returns the last object created by this actuator.
Returns: KX_GameObject
A KX_GameObject or None if no object has been created.