C#

This guide explains how to integrate Zephyr’s wind data into your own scripts using the ZephyrWind API.

The examples below demonstrate how to retrieve real-time wind vectors, optimize performance with fast calculations, and control global wind properties.

Accessing the Zephyr Wind System

All Zephyr wind data is managed through a singleton instance of ZephyrWind.

Getting Wind Data

1. Get Combined Wind at a Position

Retrieves the total combined wind vector at a specific point in world space.

This value includes:

  • Base wind direction

  • Gusts

  • Fluttering

  • Local wind zones

Use this for most general-purpose wind interactions.


2. Fast Wind Calculation

Retrieves a simplified wind vector for performance-critical systems.

This method skips localized wind zones for faster calculations, making it ideal for:

  • Particle systems

  • Far-distance vegetation

  • Large-scale environmental effects


3. Get Individual Wind Components

Separates the wind into its individual components for more control or debugging.

Outputs:

Variable
Description

combinedWind

Total combined wind at the point.

baseWind

The base directional wind component.

windFromGusting

Short-term gust variation.

windFromFluttering

Small, fast oscillations for detail motion.

windFromWindZones

Localized wind influences from placed Wind Zones.


Controlling Global Wind

You can override Zephyr’s global wind settings at runtime for dynamic weather systems or player-triggered events.

Set Target Direction

Sets the world-space direction Zephyr’s wind system will gradually move toward.


Set Target Strength

Sets the target wind strength, on a 0–5 scale:

Value
Description

0

No wind

1

Light breeze

2

Moderate wind

3

Strong wind

4

Heavy gusts

5

Violent storm

Zephyr will smoothly interpolate toward this target over time.


Example Script


Performance Tips

  • Use FastWindCalculation() for background effects or systems that don’t require per-zone accuracy.

  • Cache ZephyrWind.Instance to avoid repeated singleton lookups.

  • Avoid querying wind every frame for static objects — sample once and reuse.


See Also

Last updated