Definition
SetSoundReferenceDistance(string 3DSoundObjectName, float distance)
Description
This function sets the reference distance of 3D sound 3DSoundObjectName to distance.
Parameters
3DSoundObjectName
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.
distance
Specifies the reference distance of 3D sound 3DSoundObjectName to be set. This value must be greater than or equal to 0.0.
Example 1
function Init() SetSoundReferenceDistance("sound1", 4.5) end function Update() end
This script sets the reference distance of 3D sound “sound1” to 4.5.
Example 2
--Name of script is SetSoundReferenceDistance2.lua function Init() SetSoundReferenceDistance("this", 5.0) end function Update() end
Assume that the above script named SetSoundReferenceDistance2.lua is attached to a 3D sound object named “sound1”. In this case, string “this” in the SetSoundReferenceDistance function will be equal to “sound1”. In our example, the function SetSoundReferenceDistance sets the reference distance of current 3D sound, which is “sound1”, to 5.0.
SetSoundReferenceDistance