Game Object: getVelocity

getVelocity(point)
  • Returns the game object's velocity at the specified point on the object, including angular components.

Return Type:

  • Return type:  float list [vx, vy, vz]
     
  • vx: x-axis velocity of the point
     
  • vy: y-axis velocity of the point
     
  • vz: z-axis velocity of the point

point:

  • point is the x,y and z distance from game object center
  • Type:  float list [x,y,z]

 

Sample Code

################### get the game object's velocity
  

# import bge
import bge

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

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

# x, y and z distance from game object center
point = [ 1.0, 1.0, 1.0]

# get the game object's velocity
vec = obj.getVelocity(point)