Garry's Mod Wiki

Revision Difference

game.GetWindSpeed#566151

<function name="GetWindSpeed" parent="game" type="libraryfunc"> <description> Returns the wind's velocity at a given position, as influenced by current maps [env_wind](https://developer.valvesoftware.com/wiki/Env_wind) entities. Returns the wind's velocity at a given position, as influenced by current map's [env_wind](https://developer.valvesoftware.com/wiki/Env_wind) entities. </description> <added>2026.01.17</added> <realm>Shared</realm> <rets>⤶ <ret name="windVelocity" type="Vector">The current wind direction multiplied by the current total wind speed.</ret>⤶ </rets>⤶ <args> <arg name="pos" type="Vector" default="nil"> The point to get wind speed at. If specified, wind controllers with `windradius` other than `-1` will be taken into account, if the point is within their radius. If omitted, only the global wind controller will be used (if one exists). <note>Does not work correctly on `CLIENT` yet because the `env_wind` position is not networked to clients.</note> </arg> </args> <rets>⤶ <ret name="windVelocity" type="Vector">`windDir * windSpeed` — the current wind direction multiplied by the current total wind speed.⤶ ⤶ See [env_wind_shared.cpp#L255-L258](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/shared/env_wind_shared.cpp#L255-L258) for how it's calculated.</ret>⤶ </rets>⤶ </function> <example> <description>Visualization of the current wind's vector:</description> <code> local color_blue = Color( 175, 219, 245 ) hook.Add( "PostDrawTranslucentRenderables", "VisualizeWindVector", function() local pos = LocalPlayer():EyePos() + LocalPlayer():EyeAngles():Forward() * 100 render.DrawLine( pos, pos + game.GetWindSpeed( pos ), color_blue ) end ) </code> </example>