Constraint Actuator Distance: rayLength

rayLength
  • gets/sets the length of the distance constraint ray
     
  • Distance Constraint name: Range

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 length of the distance constraint ray

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

# constraint length
dist_ray = act.rayLength
 
Sample Code


################  Set the length of the distance constraint ray

# 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 max length to 2.5
act.rayLength = 2.5