SetSoundRollOff(string 3DSoundObjectName, float rollOff)
This function sets the rolloff of 3D sound 3DSoundObjectName to rollOff.
Specifies the 3D sound name. You can also use the name “this” for this parameter. In this case, “this” string refers to the name of the 3D sound to which this script is attached.
Specifies the rolloff of 3D sound 3DSoundObjectName to be set. This value must be greater than or equal to 0.0.
function Init() SetSoundRollOff("sound1", 1.5) end function Update() end
This script sets the rolloff of 3D sound “sound1” to 1.5.
--Name of script is SetSoundRollOff2.lua function Init() SetSoundRollOff("this", 0.5) end function Update() end
Assume that the above script named SetSoundRollOff2.lua is attached to a 3D sound object named “sound1”. In this case, string “this” in the SetSoundRollOff function will be equal to “sound1”. In our example, the function SetSoundRollOff sets the rolloff of current 3D sound, which is “sound1”, to 0.5.SetSoundRollOff