Game Object: suspendDynamics

suspendDynamics()
  • Turns off the physics on a game object
     
  • Leaves collision enabled
suspendDynamics(bool)
  • Turns off the physics on a game object
     
  • Enable/Disable collision

Enable collision:
  • bool = False
Disable collision (ghost object):
  • bool = True
Sample Code

################## suspend a game object's dynamics
  

# import bge
import bge

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

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

# suspend dynamics
obj.suspendDynamics()

Sample Code

################## suspend a game object's dynamics and make it a ghost object (disable collision)
  

# import bge
import bge

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

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

# suspend dynamics and make it a ghost object
obj.suspendDynamics(True)