Module GameTypes :: Class KX_SCA_AddObjectActuator
[hide private]
[frames] | no frames]

Class KX_SCA_AddObjectActuator

source code

PyObjectPlus --+            
               |            
          CValue --+        
                   |        
     SCA_ILogicBrick --+    
                       |    
           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 [hide private]
None
instantAddObject()
Returns the last object created by this actuator.
source code
    Deprecated
 
setObject(object)
Sets the game object to add.
source code
string, KX_GameObject or None if no object is set
getObject(name_only=0)
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
 
setAngularVelocity(vx, vy, vz)
Sets the initial angular velocity of added objects.
source code
list [vx, vy, vz]
getAngularVelocity()
Returns the initial angular velocity of added objects.
source code
KX_GameObject
getLastCreatedObject()
Returns the last object created by this actuator.
source code
    Inherited from SCA_ILogicBrick
integer
getExecutePriority()
Gets the execution priority of this logic brick.
source code
KX_GameObject
getOwner()
Gets the game object associated with this logic brick.
source code
 
setExecutePriority(priority)
Sets the priority of this logic brick.
source code
    Inherited from CValue
string
getName()
Returns the name of the CValue.
source code
    Inherited from PyObjectPlus
bool
isA(game_type)
Check if this is a type or a subtype game_type.
source code
Instance Variables [hide private]
list [vx, vy, vz] angularVelocity
the initial angular velocity of added objects.
list [vx, vy, vz] linearVelocity
the initial linear velocity of added objects.
KX_GameObject or None object
the object this actuator adds.
KX_GameObject or None objectLastCreated
the last added object from this actuator (read-only).
integer time
the lifetime of added objects, in frames.
    Inherited from SCA_ILogicBrick
int executePriority
This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
string name
The name of this CValue derived object (read-only).
KX_GameObject or None in exceptional cases. owner
The game object this logic brick is attached to (read-only).
    Inherited from PyObjectPlus
bool invalid
Test if the object has been freed by the game engine and is no longer valid.
Method Details [hide private]

setObject(object)

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.

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

Deprecated: use the object property

getObject(name_only=0)

source code 

Returns the name of the game object to be added.

Returns None if no game object has been assigned to be added.
Parameters:
  • name_only (bool) - optional argument, when 0 return a KX_GameObject
Returns: string, KX_GameObject or None if no object is set

Deprecated: use the object property

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.

Deprecated: use the time property

getTime()

source code 
Returns the lifetime of the added object, in frames.
Returns: integer

Deprecated: use the time property

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.

Deprecated: use the linearVelocity property

getLinearVelocity()

source code 
Returns the initial linear velocity of added objects.
Returns: list [vx, vy, vz]

Deprecated: use the linearVelocity property

setAngularVelocity(vx, vy, vz)

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

Deprecated: use the angularVelocity property

getAngularVelocity()

source code 
Returns the initial angular velocity of added objects.
Returns: list [vx, vy, vz]

Deprecated: use the angularVelocity property

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.

Deprecated: use the objectLastCreated property

instantAddObject()

source code 
Returns the last object created by this actuator. The object can then be accessed from objectLastCreated.
Returns: None

Instance Variable Details [hide private]

time

the lifetime of added objects, in frames. Set to 0 to disable automatic deletion.
Type:
integer