GetWaterRotation

Definition

double GetWaterRotation(string waterName)

Description

This function returns the rotation of water waterName around Y axis in degrees.

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

Rotation of water waterName  around Y axis in degrees.

Example 1

rotation = 0.0

function Init()
    rotation = GetWaterRotation("water1")

    message = string.format("\nWater rotation is > %.2f", rotation)
    PrintConsole(message)
end

function Update()

end
First, we get the rotation of water “water1” around Y axis. Then we display it in the console using the PrintConsole function.

Example 2

--Name of script is GetWaterRotation2.lua

rotation = 0.0

function Init()
    rotation = GetWaterRotation("this")

    message = string.format("\nWater rotation is > %.2f", rotation)
    PrintConsole(message)
end

function Update()

end
Assume that the above script named GetWaterRotation2.lua is attached to a water object named “water1”. In this case, string “this”  in the GetWaterRotation function will be equal to “water1”. In our example, the function GetWaterRotation returns the Y rotation of current water, which is “water1”.
adminGetWaterRotation