Constraint Actuator Location: limit

limit
  • gets/sets game object axis to be constrained.

Type: 
  • integer

Values:

  • 7 = positive X axis
     
  • 8 = positive Y axis
     
  • 9 = positive Z axis
     
  • 10 = negative X axis
     
  • 11 = negative Y axis
     
  • 12 = negative Z axis
Note:
  • The Location Constraint creates an area which the Game Object can't leave.
     
  • Uses the World Axis.
     
  • Limits movement to area defined by Min and Max.
Sample Code


################  Get the game object axis to be constrained

# import bge module
import bge

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

# get the actuator attached to the controller
# my actuator is named Max_Height

act = cont.actuators["Max_Height"]

# axis constrained
constrained = act.limit
 
Sample Code


################  Set the game object axis to be constrained

# import bge module
import bge

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

# get the actuator attached to the controller
# my actuator is named Max_Height

act = cont.actuators["Max_Height"]

# set the positive x-axis to be constrained
act.limit = 7