Dynamic Water Physics 2
Search Results for

    Show / Hide Table of Contents

    Class WindGenerator

    Generates procedural wind with randomized gusts for sail simulation. Creates realistic wind conditions by varying speed and direction over time. Provides a singleton instance accessible to all sail and wind-related components. Wind direction uses world coordinates where 0 degrees points along the positive Z-axis. Only one WindGenerator should exist per scene.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    WindGenerator
    Namespace: NWH.DWP2.SailController
    Assembly: NWH.DWP2.dll
    Syntax
    public class WindGenerator : MonoBehaviour

    Fields

    | Edit this page View Source

    Instance

    Singleton instance accessible globally. Used by SailController and HullWindApplicator to get current wind conditions.

    Declaration
    public static WindGenerator Instance
    Field Value
    Type Description
    WindGenerator
    | Edit this page View Source

    baseDirection

    Primary wind direction in degrees on the horizontal plane. 0 degrees corresponds to positive Z-axis (north in Unity coordinates). Rotation follows the right-hand rule around the Y-axis. Wind will vary around this base direction within the limits of maxDirectionVariation.

    Declaration
    [Tooltip("Base wind direction in degrees with 0 degrees indicating Z-forward ('north').")]
    public float baseDirection
    Field Value
    Type Description
    float
    | Edit this page View Source

    baseSpeed

    Average wind speed in meters per second. Wind will vary around this base speed within the limits of maxSpeedVariation. Typical sailing winds range from 5 m/s (light breeze) to 20 m/s (strong wind).

    Declaration
    [Tooltip("Base wind speed in m/s.")]
    public float baseSpeed
    Field Value
    Type Description
    float
    | Edit this page View Source

    maxDirectionVariation

    Maximum angular deviation from baseDirection during wind gusts. Measured in degrees. Higher values create more unpredictable wind shifts. Realistic values range from 15 to 45 degrees.

    Declaration
    [Tooltip("Maximum possible variation of the direction in degrees from the\r\nbaseDirection.")]
    public float maxDirectionVariation
    Field Value
    Type Description
    float
    | Edit this page View Source

    maxSpeedVariation

    Maximum speed deviation from baseSpeed during wind gusts. Measured in meters per second. Higher values create stronger variations between lulls and gusts. Can be positive or negative relative to base speed.

    Declaration
    [Tooltip("Maximum possible variation/deviation of the wind from the baseSpeed.")]
    public float maxSpeedVariation
    Field Value
    Type Description
    float
    | Edit this page View Source

    maxVariationInterval

    Longest possible duration between wind condition changes. Measured in seconds. New wind conditions are selected randomly between minVariationInterval and this value.

    Declaration
    [Tooltip("Maximum interval between the wind variations / changes.")]
    public float maxVariationInterval
    Field Value
    Type Description
    float
    | Edit this page View Source

    minVariationInterval

    Shortest possible duration between wind condition changes. Measured in seconds. New wind conditions are selected randomly between this value and maxVariationInterval.

    Declaration
    [Tooltip("Minimum interval between the wind variations / changes.")]
    public float minVariationInterval
    Field Value
    Type Description
    float

    Properties

    | Edit this page View Source

    CurrentDirection

    Current wind direction in degrees on the horizontal plane. Smoothly interpolates between randomized target directions. 0 degrees corresponds to positive Z-axis.

    Declaration
    public float CurrentDirection { get; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    CurrentSpeed

    Current wind speed magnitude in meters per second. Smoothly interpolates between randomized target speeds.

    Declaration
    public float CurrentSpeed { get; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    CurrentWind

    Current wind vector in world space. Combines CurrentDirection and CurrentSpeed into a directional velocity vector. Updated every FixedUpdate with smooth damping between gust transitions. Measured in meters per second.

    Declaration
    public Vector3 CurrentWind { get; }
    Property Value
    Type Description
    Vector3
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics