# How do i calculate wind speed value trough distance?

Sooo i made simple script which calculates distance between cube and air plane, and now i need to get wind speed value with this (me struggling with this) Closer to cube higher wind speed, further lower

float distance = Vector3.Distance(gameObject.transform.position, airCraft.transform.position);

weatherSystem.windSpeed = distance/windDistanceFallout;

Airspeed is the relative difference between a moving object and the moving volume (fluid) that it is moving through.

In actual aircraft this is determined by comparing the ram air pressure from the pitot tube with the static air pressure from the static source port.

What exactly are you trying to do here with distance???

I want to use distance for wind speed measure, like closer to cube higher wind speed, further lower wind speed. For Example: Right infront of cube wind speed will be 255 km/h, and some where at other end of map wind speed will be 0

You could develop a function for that.

Linear would be:

var windspeed = MaxWind * (1 - Distance / MaxDistance);

One-over might be:

var windspeed = MaxWind / (BaseDistance + Distance * FalloffRate);

The actual function for a given body passing through a fluid is entirely dependent on the shape of the body.

Alternately you could use something like a public AnimationCurve lookup table to look it up, then just set the curve up however you like in the editor.

Yes this works but if i far away from cube then return value goes negative, i need it to stay at 0

Then donâ€™t let Distance get above MaxDistance!!

I made that is wind speed is lower then 0 then set it to 0 and now works perfectly!