Game Object: applyTorque

applyTorque(torq, local)
  • applies torque to the game object.

torq:
  • Torque to apply to game object
     
  • Type:  list [ fx, fy, fz]
     
  • fx: amount of torque to apply to x-axis
     
  • fy: amount of torque to apply to y-axis
     
  • fz: amount of torque to apply to z-axis
local:
  • Type:  boolean
     
  • world axis: 0 or False
     
  • local axis: 1 or True
Note:
  • Object types: Dynamic and Rigid body.
     
  • Torque is a twisting force that tends to cause rotation.
Sample Code


################## Apply torque to the game object
  

# import bge
import bge

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

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

# apply torque to the z-axis
torq = [ 0.0, 0.0, 50.0]

# use game object axis
local = True

# apply impulse
obj.applyTorque(torq, local)