Set custom fog||doc135699

September 20, 2022

Format

 GameSettings:setCustomFog(start, end, density, color) 

Description

Set a custom fog, and configure the specific display form of the fog according to the attribute parameters.


Precautions

  • The fog effect shows that the skybox needs to be used in the scene to take effect. The scene has a skybox by default.
  • You need to unhide the fog option in the map properties in the editor, or change the hidden fog attribute in the game settings class to false in the client code, in order to use this function in the game to see the fog effect

Parameters

Variable name type Description
start float The distance at which the player's vision is not affected
end float The gradient distance from the player's vision to the fog
density float density of fog
color Vector3 The color of the fog, the value range is 0~1


Code Samples

local gameSettings = Blockman.Instance().gameSettings
gameSettings.hideFog = false
gameSettings:setCustomFog(4, 15, 0.5, {x=1,y=0,z=0})