Definition
double GetWaterUV(string waterName)
Description
This function returns the texture UV of water object waterName.
Parameters
waterName
Specifies the water name. You can also use the name “this” for this parameter. In this case, “this” string refers to the name of the water to which this script is attached.
Return Value
Texture UV of water object.
Example 1
UV = 0.0 function Init() UV = GetWaterUV("water1") message = string.format("\nWater UV is > %.2f", UV) PrintConsole(message) end function Update() end
First, we get the texture UV of water “water1”. Then we display it in the console using the PrintConsole function.
Example 2
--Name of script is GetWaterUV2.lua UV = 0.0 function Init() UV = GetWaterUV("this") message = string.format("\nWater UV is > %.2f", UV) PrintConsole(message) end function Update() end
Assume that the above script named GetWaterUV2.lua is attached to a water object named “water1”. In this case, string “this” in the GetWaterUV function will be equal to “water1”. In our example, the function GetWaterUV returns the texture UV of current water, which is “water1”.
GetWaterUV