Dynamic Water Physics 2
Search Results for

    Show / Hide Table of Contents

    Class WaterDataProvider

    Base class for providing water surface data to WaterObjects. Implementations provide water height, flow velocity, and surface normal information. Uses a trigger collider to automatically detect and register WaterObjects that enter the water. Inherit from this class to create adapters for different water systems.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    WaterDataProvider
    FlatWaterDataProvider
    RaycastWaterDataProvider
    Namespace: NWH.DWP2.WaterData
    Assembly: NWH.DWP2.dll
    Syntax
    public abstract class WaterDataProvider : MonoBehaviour

    Fields

    | Edit this page View Source

    _singleHeightArray

    Declaration
    protected float[] _singleHeightArray
    Field Value
    Type Description
    float[]
    | Edit this page View Source

    _singlePointArray

    Declaration
    protected Vector3[] _singlePointArray
    Field Value
    Type Description
    Vector3[]
    | Edit this page View Source

    _triggerCollider

    Declaration
    protected Collider _triggerCollider
    Field Value
    Type Description
    Collider

    Methods

    | Edit this page View Source

    Awake()

    Declaration
    public virtual void Awake()
    | Edit this page View Source

    GetWaterFlows(WaterObject, ref Vector3[], ref Vector3[])

    Returns water flow velocity at each given point. Override this method to provide water flow data from your water system. Flow should be in world space and relative to the world, not the WaterObject.

    Declaration
    public virtual void GetWaterFlows(WaterObject waterObject, ref Vector3[] points, ref Vector3[] waterFlows)
    Parameters
    Type Name Description
    WaterObject waterObject

    WaterObject requesting the data.

    Vector3[] points

    Position array in world coordinates.

    Vector3[] waterFlows

    Water flow velocity array in world coordinates. Corresponds to positions.

    | Edit this page View Source

    GetWaterHeight(WaterObject, Vector3)

    Returns water height at the given world position.

    Declaration
    public float GetWaterHeight(WaterObject waterObject, Vector3 worldPoint)
    Parameters
    Type Name Description
    WaterObject waterObject

    WaterObject making the query.

    Vector3 worldPoint

    Position in world coordinates.

    Returns
    Type Description
    float

    Water surface height at the given point.

    | Edit this page View Source

    GetWaterHeightSingle(WaterObject, Vector3)

    Returns water height at a single point. Less efficient than batch queries but useful for one-off checks.

    Declaration
    public virtual float GetWaterHeightSingle(WaterObject waterObject, Vector3 point)
    Parameters
    Type Name Description
    WaterObject waterObject

    WaterObject requesting the data.

    Vector3 point

    Position in world coordinates.

    Returns
    Type Description
    float

    Water height at the given point.

    | Edit this page View Source

    GetWaterHeights(WaterObject, ref Vector3[], ref float[])

    Returns water height at each given point. Override this method to provide water height data from your water system.

    Declaration
    public virtual void GetWaterHeights(WaterObject waterObject, ref Vector3[] points, ref float[] waterHeights)
    Parameters
    Type Name Description
    WaterObject waterObject

    WaterObject requesting the data.

    Vector3[] points

    Position array in world coordinates.

    float[] waterHeights

    Water height array in world coordinates. Corresponds to positions.

    | Edit this page View Source

    GetWaterHeightsFlowsNormals(WaterObject, ref Vector3[], ref float[], ref Vector3[], ref Vector3[], bool, bool, bool)

    Queries water data based on enabled flags. Calls the appropriate getter methods based on which data types are requested.

    Declaration
    public void GetWaterHeightsFlowsNormals(WaterObject waterObject, ref Vector3[] points, ref float[] waterHeights, ref Vector3[] waterFlows, ref Vector3[] waterNormals, bool useWaterHeight, bool useWaterNormals, bool useWaterFlow)
    Parameters
    Type Name Description
    WaterObject waterObject

    WaterObject requesting the data.

    Vector3[] points

    Position array in world coordinates.

    float[] waterHeights

    Output water heights array.

    Vector3[] waterFlows

    Output water flows array.

    Vector3[] waterNormals

    Output water normals array.

    bool useWaterHeight

    Should water heights be queried.

    bool useWaterNormals

    Should water normals be queried.

    bool useWaterFlow

    Should water flows be queried.

    | Edit this page View Source

    GetWaterNormals(WaterObject, ref Vector3[], ref Vector3[])

    Returns water surface normals at each given point. Override this method to provide water normal data from your water system.

    Declaration
    public virtual void GetWaterNormals(WaterObject waterObject, ref Vector3[] points, ref Vector3[] waterNormals)
    Parameters
    Type Name Description
    WaterObject waterObject

    WaterObject requesting the data.

    Vector3[] points

    Position array in world coordinates.

    Vector3[] waterNormals

    Water surface normal array in world coordinates. Corresponds to positions.

    | Edit this page View Source

    PointInWater(WaterObject, Vector3)

    Checks if a point is underwater. Accounts for wave height when water normals are supported.

    Declaration
    public bool PointInWater(WaterObject waterObject, Vector3 worldPoint)
    Parameters
    Type Name Description
    WaterObject waterObject

    WaterObject making the query.

    Vector3 worldPoint

    Position to check in world coordinates.

    Returns
    Type Description
    bool

    True if the point is below the water surface.

    | Edit this page View Source

    SupportsWaterFlowQueries()

    Does this water system support water velocity queries?

    Declaration
    public abstract bool SupportsWaterFlowQueries()
    Returns
    Type Description
    bool

    True if it does, false if it does not.

    | Edit this page View Source

    SupportsWaterHeightQueries()

    Does this water system support water height queries?

    Declaration
    public abstract bool SupportsWaterHeightQueries()
    Returns
    Type Description
    bool

    True if it does, false if it does not.

    | Edit this page View Source

    SupportsWaterNormalQueries()

    Does this water system support water normal queries?

    Declaration
    public abstract bool SupportsWaterNormalQueries()
    Returns
    Type Description
    bool

    True if it does, false if it does not.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics