Namespace NWH.DWP2.SailController
Classes
HullWindApplicator
Applies wind drag forces to the hull of a sailing vessel based on the global wind conditions. Calculates the projected area of the hull facing the wind and applies an appropriate drag force. Does not account for the waterline - dimensions should represent only the hull portion above water. Requires a WindGenerator to be present in the scene.
SailController
Manages sail physics by calculating and applying lift and drag forces based on sail geometry, orientation, and wind conditions. Uses four corner transforms (a, b, c, d) to define sail shape, enabling dynamic sail configurations including furling and multi-part sails. Calculates apparent wind from true wind and vessel velocity, then applies aerodynamic forces at the sail's surface-weighted center. The corner transforms follow a clockwise pattern: a (bottom left/front), b (top left/front), c (top right/rear), d (bottom right/rear). Corner transforms can be attached to different parents to enable sail furling or complex rigging systems. Use SailRotator for user-controlled sail rotation. Requires a WindGenerator in the scene and a SailPreset for aerodynamic coefficients.
SailPreset
Defines the aerodynamic characteristics of a sail through lift and drag coefficient curves. Contains the relationship between angle of attack and force generation. Different sail types (square, lateen, bermuda, etc.) can be represented by different presets. Can be created via Assets > Create > NWH > DWP2 > SailPreset.
SailRotator
Rotates a transform based on player input from the AdvancedShipController. Used to control sail orientation in response to the RotateSail input axis. Typically attached to a sail boom or mast that rotates horizontally. Requires an AdvancedShipController component on a parent GameObject.
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.
WindIndicator
Visual indicator that rotates to show wind direction. Displays apparent wind when attached as a child of a SailController. Displays true wind from the WindGenerator when not under a SailController. Useful for debugging sail setup and helping players understand wind conditions. The transform's forward direction will point into the wind.