Sound Actuator Loop Bidirectional: distance_maximum

distance_maximum
  • gets/sets maximum distance at which you can hear the sound.
  • Sound Actuator name:  Maximum Distance

Type: 
  • float number

Range:

  • 0.00 to infinite
Loop Bidirectional:
  • Plays the sound file from start to finish.  Then finish to start.  Over and over.
  • Positive Pulse:  Starts playing the sound file from the beginning.
  • Negative pulse:  Keeps playing the sound file until it reaches the end, then stops playing.
Sample Code


################  get the maximum distance of the 3D sound

# import bge module
import bge

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

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

act = cont.actuators["Song"]

# get the maximum distance of the 3D sound
dist = act.distance_maximum
 
Sample Code


################  set the maximum distance of the 3D sound

# import bge module
import bge

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

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

act = cont.actuators["Song"]

# set the maximum distance of the 3D sound to 100.0
act.distance_maximum = 100.0