Definition
SetSoundPosition(string 3DSoundObjectName, float x, float y, float z)
Description
This function sets the position of 3D sound 3DSoundObjectName.
Parameters
3DSoundObjectName
Specifies the name of the 3D sound object. You can also use the name “this” for this parameter. In this case, “this” refers to the 3D sound name that this script is attached to.
x, y, z
Specify the 3D position of 3D sound 3DSoundObjectName as three values x, y and z.
Example 1
function Init() SetSoundPosition("sound1", 2.5, 5.0, 7.0) end function Update() end
In this script, SetSoundPosition function sets the position of 3D sound “sound1” to (2.5, 5.0, 7.0).
Example 2
--Name of script is SetSoundPosition2.lua function Init() SetSoundPosition("this", 2.5, 5.0, 7.0) end function Update() end
Assume that the above script named SetSoundPosition2.lua is attached to a 3D sound object named “sound1”. In this case, string “this” in the SetSoundPosition function will be equal to “sound1”. In our example, the function SetSoundPosition sets the position of current 3D sound, which is “sound1”, to (2.5, 5.0, 7.0).
SetSoundPosition