-
Notifications
You must be signed in to change notification settings - Fork 16
class_waterarea3d
This file is automatically generated. To make changes, please edit the corresponding xml file in the doc_classes/ folder instead.
Inherits:
Defines an area in which a HydroRigidBody will be affected by buoyancy and related forces.
The purpose of the WaterArea3D node is threefold. First, it limits the area in which a HydroRigidBody is evaluated for potential buoyancy. This means that if you only need water in a small area of your scene, the HydroRigidBody will not incur a performance penalty while it is outside the bounds of the WaterArea3D.
The second purpose of the WaterArea3D is to define the surface of the water. For a flat body of water, set the water_height parameter to the global-space height of the water. For a body of water with waves or any other advanced scenarios, attach a script to the WaterArea3D and define a _get_water_heights(positions) function. The positions parameter is a Vector3Array. For each Vector3 in the array, adjust its Y value to the height of the water at the given X and Z position. The return value of the function should be the Vector3Array with the Y-values changed. When this function is defined, the water_height parameter is ignored.
Finally, the WaterArea3D acts as a standard Area3D node. It can be used to trigger sound or particle effects to make an object splash when it hits the water.
- float density
Default | 1000.0 |
Setter | set_density(value) |
Getter | get_density() |
Sets the density of the water in this area. Freshwater is 1000 kg/m^3, and seawater ranges from 1020 - 1029 kg/m^3.
- float viscosity
Default | 1.0 |
Setter | set_viscosity(value) |
Getter | get_viscosity() |
Adjusts the viscosity of the water in this area. This value changes the resistance to motion through the fluid without affecting buoyancy. The default value of 1.0 is a good starting point for water; for thicker substances such as maple syrup or lava try increasing the value.
- float water_height
Default | 0.0 |
Setter | set_water_height(value) |
Getter | get_water_height() |
Sets a constant global-space water height. This value is not used if you create a custom wave height function instead.
- Vector3 get_flow_direction ( )
- void set_flow_direction ( )