Constraint Actuator Distance: time

time
  • gets/sets the maximum number of frames for the constraint to be active

Type: 
  • integer
     
  • 0 = forever
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 number of frames for the constraint to be active

# 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 time
active = act.time
 
Sample Code


################  Set the number of frames for the constraint to be active

# 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 time to 5 frames
act.time = 5