Game Object: setAngularVelocity

setAngularVelocity(angVel ,local)
  • Sets the angular velocity around the game object's object center. 
  • Uses either local or world axis.

angVel:

  • Type: float list [ xAngVel, yAngVel, zAngVel]
  • xAngVel = angular velocity around the x-axis
  • yAngVel = angular velocity around the y-axis
  • zAngVel = angular velocity around the z-axis
local:
  • axis (world or local)
  • Type:  boolean
  • world axis: 0 or False
  • local axis: 1 or True
Note:
  • Physics Type: Rigid Body and Dynamic.
Sample Code

################## set the angular velocity
   

# import bge
import bge

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

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

# set angular velocity to 20 around z-axis
angVel = [0.0, 0.0, 20.0]

# use the game object axis
local = True

# set angular velocity around game object axis
obj.setAngularVelocity(angVel, local)