Constraint Actuator Distance: distance

distance
  • gets/sets the distance that the game object has been set to maintain from the surface of an object
     
  • Distance Actuator name: Force Distance

Type: 
  • float number
Note:
  • The Distance Constraint sets the target distance of the Game Object
     
  • Uses the World or Local Axis
     
  • Distance is measured from the Object Center of the Game Object.
Sample Code

################  Get the force distance

# 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"]

# force distance
dist = act.distance
 
Sample Code

################  Set the force distance

# 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 force distance to 2.00
act.distance = 2.0