IN THIS ARTICLE
Infinite Ocean Component Request Bus Interface
Infinite Ocean Component Request Bus Interface
Use the following request functions with the EBus interface to communicate with other components of your game.
For more information about using the event bus (EBus) interface, see Working with the Event Bus (EBus) system.
Lua Scripting
In general, the Lua scripting API for the Infinite Ocean component maps directly to the component properties with the Get* and Set* functions. However, there are some exceptions where there is only a Get function, and you can’t directly set a value, such as the ocean height.
Note
You can specify float numbers for most functions, but some require an enumeration and/or a boolean value.
Example
function example:OnActivate()
OceanEnvironmentRequestBus.Broadcast.SetFogDensity(2)
OceanEnvironmentRequestBus.Broadcast.GetFogDensity()
end
OceanLevel
Returns the height of the ocean in the world z-axis.
Note
There is no function to set the ocean level, since this parameter is attached to the Transform component.
Parameters
None
Return
Type: Float
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.GetOceanLevel()
WaterTessellationAmount
Sets the amount of geometry tessellation for rendering the ocean surface.
Parameters
Type: Int
Return
Type: Int
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetWaterTessellationAmount(int)
OceanEnvironmentRequestBus.Broadcast.GetWaterTessellationAmount()
AnimationWindDirection and AnimationWindSpeed
Sets the direction and speed of the ocean wind.
Parameters
Type: Float
Return
Type: Float
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetAnimationWindDirection(float)
OceanEnvironmentRequestBus.Broadcast.GetAnimationWindDirection()
OceanEnvironmentRequestBus.Broadcast.SetAnimationWindSpeed(float)
OceanEnvironmentRequestBus.Broadcast.GetAnimationWindSpeed()
AnimationWavesSpeed, AnimationWavesSize, and AnimationWavesAmount
Specifies the animation parameters of the ocean waves, such as speed, size, and amount.
Parameters
Type: Float
Return
Type: Float
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetAnimationWavesSpeed(float)
OceanEnvironmentRequestBus.Broadcast.GetAnimationWavesSpeed()
OceanEnvironmentRequestBus.Broadcast.SetAnimationWavesSize(float)
OceanEnvironmentRequestBus.Broadcast.GetAnimationWavesSize()
OceanEnvironmentRequestBus.Broadcast.SetAnimationWavesAmount(float)
OceanEnvironmentRequestBus.Broadcast.GetAnimationWavesAmount()
ReflectResolutionScale
Specifies the scale of the screen resolution to use for rendering ocean reflections.
Parameters
Type: Float
Return
Type: Float
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetReflectResolutionScale(float)
OceanEnvironmentRequestBus.Broadcast.GetReflectResolutionScale()
ReflectionAnisotropic
Enables the anisotropic filter for rendered ocean reflections.
Parameters
Type: Boolean
Return
Type: Boolean
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetReflectionAnisotropic(boolean)
OceanEnvironmentRequestBus.Broadcast.GetReflectionAnisotropic()
ReflectRenderFlag
For each reflection flag, you can specify how the ocean renders reflections.
You can specify the following flags:
ReflectionFlags.TerrainDetailMaterials
ReflectionFlags.StaticObjects
ReflectionFlags.Particles
ReflectionFlags.Entities
Parameters
Type: Enum flag and boolean
Return
Type: Boolean
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetReflectRenderFlag(ReflectionFlags.TerrainDetailMaterials, boolean)
OceanEnvironmentRequestBus.Broadcast.GetReflectRenderFlag(ReflectionFlags.TerrainDetailMaterials))
UseOceanBottom
Toggles the infinite plane below the ocean.
Parameters
Type: Boolean
Return
Type: Boolean
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetUseOceanBottom(boolean)
OceanEnvironmentRequestBus.Broadcast.GetUseOceanBottom()
GodRaysEnabled
Enablesgod rays (sun beams) under the ocean.
Parameters
Type: Boolean
Return
Type: Boolean
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetGodRaysEnabled(boolean)
OceanEnvironmentRequestBus.Broadcast.GetGodRaysEnabled()
UnderwaterDistortion
Specifies the amount of the scene that is distorted when it renders while the camera is underwater.
Parameters
Type: Float
Return
Type: Float
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetUnderwaterDistortion(float)
OceanEnvironmentRequestBus.Broadcast.GetUnderwaterDistortion()
FogColor, FogColorMultiplier, and NearFogColor
Specifies the color for the underwater fog of the ocean.
You can specify a color value, such as Color(1.0,2.0,3.0,1.0)
, and then pass it as an argument like the following: SetFogColor(Color(1.0,2.0,3.0,1.0))
The FogColorPremultiplied
function is applied to the ocean’s fog color. You can use the GetFogColorPremultiplied
function to return the result of Fog Color * Fog Color Multiplier.
Note
Currently, you cannot directly specify values for the FogColorPremultiplied
function.
For SetFogColorMultiplier
and GetFogColorMultiplier
functions:
Parameters
Type: Float
Return
Type: Float
Scriptable
Yes
For SetFogColor
, GetFogColor
, SetNearFogColor
, and GetNearFogColor
functions:
Parameters
Type: Color
Return
Type: Color
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetFogColor(Color)
OceanEnvironmentRequestBus.Broadcast.GetFogColor()
OceanEnvironmentRequestBus.Broadcast.SetFogColorMultiplier(float)
OceanEnvironmentRequestBus.Broadcast.GetFogColorMultiplier()
OceanEnvironmentRequestBus.Broadcast.SetNearFogColor(Color)
OceanEnvironmentRequestBus.Broadcast.GetNearFogColor()
OceanEnvironmentRequestBus.Broadcast.GetFogColorPremultiplied()
CausticsEnabled
Applies the caustics effect of the ocean on geometry below the ocean surface.
Parameters
Type: Boolean
Return
Type: Boolean
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetCausticsEnabled(boolean)
OceanEnvironmentRequestBus.Broadcast.GetCausticsEnabled()
CausticsDepth, CausticsIntensity, CausticsTiling, CausticsDistanceAttenuation
Specifies the caustics parameters for the Infinite Ocean component.
Parameters
Type: Float
Return
Type: Float
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetCausticsDepth(float)
OceanEnvironmentRequestBus.Broadcast.GetCausticsDepth()
OceanEnvironmentRequestBus.Broadcast.SetCausticsIntensity(float)
OceanEnvironmentRequestBus.Broadcast.GetCausticsIntensity()
OceanEnvironmentRequestBus.Broadcast.SetCausticsTiling(float)
OceanEnvironmentRequestBus.Broadcast.GetCausticsTiling()
OceanEnvironmentRequestBus.Broadcast.SetCausticsDistanceAttenuation(float)
OceanEnvironmentRequestBus.Broadcast.GetCausticsDistanceAttenuation()
OceanMaterialName
Renders the ocean with the assigned material.
You can find the default material in the lumberyard_version/dev/Engine/EngineAssets/Materials/Water/ocean_default.mtl
directory.
Parameters
The path to the ocean material file.
Type: String
Return
Type: String
Scriptable
Yes
Example
OceanEnvironmentRequestBus.Broadcast.SetOceanMaterialName(string)
OceanEnvironmentRequestBus.Broadcast.GetOceanMaterialName()