Blender 3d Game engine: KX_SCA_AddObjectActuator
Methods:
getAngularVelocity instantAddObject
getLastCreatedObject setAngularVelocity
getLinearVelocity setLinearVelocity
getObject setObject
getTime setTime
Variables:
---------- ----------
Constants:
---------- ----------
Inherited
Methods:
getExecutePriority isA
getOwner setExecutePriority
getName ----------



Instance Methods

getAngularVelocity

getAngularVelocity()

Returns the angular velocity that will be applied to the added object.

Return type:  float list  [ wx, wy, wz]

wx:  Angular velocity on the x axis
Type:  float number

wy:  Angular velocity on the y axis
Type:  float number

wz:  Angular velocity on the z axis
Type:  float number

Note:
Doesn't return whether it is being applied to the local or the world axis.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator named act
act = controller.getActuator("act")

# get camera height
angVel = act.getAngularVelocity()

getLastCreatedObject

getLastCreatedObject()

Returns the last game object created by this actuator.

Returns None if there isn't a last created object

Return type:  KX_GameObject

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# get last created game object
last = spawn.getLastCreatedObject()

# get the name
objName = last.name

getLinearVelocity

getLinearVelocity()

Returns the linear velocity that will be applied to the added object.

Return type:  List [ vx, vy, vz]

vx:  linear velocity on the x axis
Type:  float number

vy:  linear velocity on the y axis
Type:  float number

vz:  linear velocity on the z axis
Type:  float number

Note:
Doesn't return whether it is being applied to the local or the world axis.

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# get initial linear velocity
linVelocity = spawn.getLinearVelocity()

getObject

getObject()

Returns the name of the game object to be added.

Return type:  string

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# get name of game obect
name = spawn.getObject()

getTime

getTime()

Returns how many frames the object will live.  0 means it will live forever.

Return type:  integer

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# get life span in frames
lifeSpan = spawn.getTime()

instantAddObject

instantAddObject()

Instantly adds the  game object.  Without activating the actuator.

Note:
Object to be added doesn't have to be on a non-visible layer

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# get object on visible layer
objList = GameLogic.getCurrentScene().getObjectList()
guard = objList["OBGuard"]

# tell AddObject actuator which object is to be added
spawn.setObject(guard)

# add the game object
spawn.instantAddObject()

setAngularVelocity

setAngularVelocity(vx, vy, vz)

Sets the initial angular velocity of the added object.

vx = x component of angular velocity
Type:  float

vy = y component of angular velocity
Type:  float

vz = z compenent of angular velocity
Type:  float

Note:
Angular velocity can be applied to either the local or world axis.
But there isn't a way to set it using python.
Have to use the actuator button.

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# set initial linear velocity
spawn.setAngularVelocity( 20.0, 0.0, 0.0)

setLinearVelocity

setLinearVelocity(vx, vy, vz)

Sets the initial linear velocity of the added object.

vx = x component of linear velocity
Type:  float

vy = y component of linear velocity
Type:  float
vz = z compenent of linear velocity
Type:  float

Note:
Linear velocity can be applied to either the local or world axis.
But there isn't a way to set it using python.
Have to use the actuator button.

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# set initial linear velocity
spawn.setLinearVelocity( 20.0, 0.0, 0.0)

setObject

setObject(obj)

Sets the game object to be added.

obj:
Type:  KX_GameObject
   or
   string

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# set object to be spawned
spawn.setObject("WildDog")

# add the game object
spawn.instantAddObject()

setTime

setTime(time)

Sets the number of frames you want the object to live. 

Use 0 if you want the object to live forever.

time:
Type:  integer

Sample Code

# get controller
controller = GameLogic.getCurrentController()

# get actuator named Spawn
spawn = controller.getActuator("Spawn")

# set object to live forever
spawn.setTime(0)

# use it
GameLogic.addActiveActuator(spawn, True)



Instance Methods: Inherited

getExecutePriority

getExecutePriority()

Gets the execute priority of the logic brick

Return Type:  integer

Doesn't work:
Crashes Blender

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator named act
act = controller.getActuator("act")

# get brick priority
priority = act.getExecutePriority()

getOwner

getOwner()

Gets the game object that owns the logic brick.

Return Type:  KX_GameObject

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator named act
act = controller.getActuator("act")

# get brick owner
owner = act.getOwner()

setExecutePriority

setExecutePriority(priority)

Sets the execution priority of the logic brick.

priority:
   Type:  integer
0 is first
1 is second
etc.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator named act
act = controller.getActuator("act")

# set brick priority to be first
act.setExecutePriority(0)





isA

isA(Type)

Checks the Object type.
(KX_GameObject, SCA_ILogicBrick, KX_Scene, etc.)

Type:  String

Return Type:  Bool
1 = True
0 = False

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the object controller attached to
owner = controller.getOwner()

# is owner a GameObject?
gameObject = owner.isA("KX_GameObject")





getName

getName()

Returns the name of actuator

Return Type:  string

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get a list of the attached actuators 
actList = controller.getActuators()

# loop through the list of actuators
for act in actList:

# look for an actuator named "RocketMotion"
if act.getName() == "RocketMotion":

# use it
GameLogic.addActiveActuator(act, True)

# Done.  Break out of loop
break


Blender 3D
Game Engine
Rapid prototyping for 3D games. Test realtime 3D gameplay without having to compile the game code. 3D game models automatically added.  GLSL shaders. Normal Mapping and Parallax Mapping. All OpenGL Lighting modes. This includes transparencies, animated and reflection mapped textures. Multiple textures and materials. UV mapping. Per-pixel lighting and dynamic lighting.  Uses Bullet Physics. Soft body dynamics. Rigid body dynamics. Collision detection and dynamics simulation. Collision bounds of all types. Car physics engine with full support for vehicle dynamics. (Spring reactions, stiffness, damping, tire friction etc.).