Game Object: getLinearVelocity

getLinearVelocity(local)
  • Returns an object center's linear speed.

Return Type:

  • float list [ x, y, z]

local:

  • axis (world or local)
  • Type:  boolean
  • world axis: 0 or False
  • local axis: 1 or True
Sample Code

################## get the game object linear velocity
  

# import bge
import bge

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

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

# use the world axis
local = False

# get game object center linear velocity
linVelocity = obj.getLinearVelocity(local)