Game Object: mass

mass
  • gets/sets the game object's mass.

Type:

  • float number

Range:

  • 0.01 to 10,000.00
Note:
  • Physics Type: Rigid Body and Dynamic.
Sample Code

################## get the game object's mass
  
# import bge
import bge

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

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

# get the game object's mass
weight = obj.mass

Sample Code

################## set the object's mass
  
# import bge
import bge

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

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

# set the game object's mass
obj.mass = 165.4