GetWaterUnderwaterFogDensity

Definition

double GetWaterUnderwaterFogDensity(string waterName)

Description

This function returns the underwater fog density 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

Underwater fog density of water object.

Example 1

fog_density = 0.0

function Init()
    fog_density = GetWaterUnderwaterFogDensity("water1")

    message = string.format("\nUnderwater fog density of water is > %.2f", fog_density)
    PrintConsole(message)
end

function Update()

end
First, we get the underwater fog density of water “water1”. Then we display it in the console using the PrintConsole function.

Example 2

--Name of script is GetWaterUnderwaterFogDensity2.lua

fog_density = 0.0

function Init()
    fog_density = GetWaterUnderwaterFogDensity("this")

    message = string.format("\nUnderwater fog density of water is > %.2f", fog_density)
    PrintConsole(message)
end

function Update()

end
Assume that the above script named GetWaterUnderwaterFogDensity2.lua is attached to a water object named “water1”. In this case, string “this”  in the GetWaterUnderwaterFogDensity function will be equal to “water1”. In our example, the function GetWaterUnderwaterFogDensity returns the underwater fog density of current water, which is “water1”.
adminGetWaterUnderwaterFogDensity