Game Object: applyMovement

applyMovement(move, local)
  • Moves the game object a set distance (works like Motion Actuator Loc).

move:
  • Amount to move the game object.
  • Type: list [ x, y, z]
     
  • x: distance to move on the x-axis
     
  • y: distance to move on the y-axis
     
  • z: distance to move on the z-axis
local:
  • axis (world or local) used to move game object.
  • Type:  boolean
  • world axis: 0 or False
  • local axis: 1 or True
Note:
  • Object types: Dynamic, Rigid body, Static, Character, Sensor, Occlude and No Collision.
Sample Code

################## Move the game object a set amount
  

# import bge
import bge

# get controller
cont = bge.logic.getCurrentController()

# get object that controller is attached to
obj = cont.owner

# move game object 3.2 on the z-axis
move = [ 0.0, 0.0, 3.2]

# use local axis
local = True

# move the game object
obj.applyMovement( move, local)