Is there a way get the current wind vector from a Wind Zone?

I’m working on a simple sailing game, and thought I might be able to use a Wind Zone to generate a wind pattern that changes over time in an at least somewhat realistic manner. Is there a way get the current wind speed and direction from a Wind Zone so I can use it in my own code?

I’m also looking for a way to get the current wind force vector from a WindZone component. I’m starting to think the only solution is to hack a workaround that will result in wind speed from the WindZone component, but not force unfortunately.

(1) Create an invisible particle system that spawns one particle, has zero initial velocity and external forces enabled. This will allow the particle to move with the WindZone component.

(2) Create a component that requires a particle system, gets the particle in LateUpdate(), gets the difference between the current location and the last known location divided by elapsed seconds and finally sets the particle location back to the center of the particle system.

This should result in a wind speed that is late by one frame. I suppose that’s better than nothing. I wish Unity would make a public Vector3 WindZone.GetCurrentWindSpeed() or public Vector3 WindZone.GetCurrentWindForce() whichever’s more appropriate for their implementation.

Hi,

did you already find any solution for this? I also need the wind direction and speed for a simple sailing simulation.

Thank you four your help!,Hi,

I also need the direction and the speed of a windzone. Did you already find a solution for this?

direction is simply the transform of the WindZone gameObject…

(Be sure to add a “WindZone_TAG” to the WindZone gameObject)

I am not sure what the calculations would be to get the results of the wind stuff,

but here is a start

    public GameObject Wind;    
    public float WindZoneMain;
    public float WindZoneTurbulence;
    public float windZonePulseMagnitude;
    public float windZonePulseFrequency;
    public float windradius;
    public float windspeed;
    public float windTurbulence;
    public float windAngle;

    Wind = GameObject.FindGameObjectWithTag("WindZone_TAG");
    windradius = Wind.GetComponent<WindZone>().radius;
    windspeed = Wind.GetComponent<WindZone>().windMain;
    windTurbulence = Wind.GetComponent<WindZone>().windTurbulence;
    windZonePulseMagnitude = Wind.GetComponent<WindZone>().windPulseMagnitude;
    windZonePulseFrequency = Wind.GetComponent<WindZone>().windPulseFrequency;
    windAngle = Wind.transform.rotation.y;