Garry's Mod Wiki

Revision Difference

game.GetWindSpeed#566149

<function name="GetWindSpeed" parent="game" type="libraryfunc"> <description> Return wind direction multiplied on speed of [env_wind](https://developer.valvesoftware.com/wiki/Env_wind) entity. Returns the wind's velocity of the global or local [env_wind](https://developer.valvesoftware.com/wiki/Env_wind)(-s) at the current time (<page>Global.CurTime</page>). </description> <added>2026.01.17</added> <realm>Shared</realm> <rets> <ret name="windDir" type="Vector">Return value is basically `windDir * windSpeed`.</ret> <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">Optional arg that takes into account wind controllers with radius above `-1`. Without arg should use only the global controller (if one exists).⤶ <note>Position argument unfortunately will not do anything on `CLIENT` yet because the `env_wind` position is never networked to the clients.</note>⤶ </arg>⤶ <arg name="pos" type="Vector" default="nil">⤶ The point to get it at.If specified, wind controllers with `windradius` above `-1` will be taken into account.⤶ If omitted, only the global controller should be used (if one exists).⤶ <note>Unfortunately bears no effect on `CLIENT` yet because the `env_wind` position is non-networked.</note>⤶ </arg>⤶ </args> </function> <example> <description>Visualization of wind direction:</description>⤶ <description>Visualization of the current wind's vector:</description>⤶ <code> local color_red = Color(255, 0, 0) hook.Add( "PostDrawTranslucentRenderables", "MySuper3DRenderingHook", function() local eyePos = LocalPlayer():EyePos() + LocalPlayer():EyeAngles():Forward() * 100 render.DrawLine( eyePos, eyePos + game.GetWindSpeed( eyePos ), color_red ) end ) 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></example>⤶