The GlobalWind vector sets the direction and strength that wind blows through an experience, affecting terrain grass and dynamic clouds. You can set it as a constant vector, or adjust it through scripting to create cyclical gusts of wind. Additionally, you can influence particles to follow the global wind vector.
To set the global wind vector in Studio:
Select the top-level Workspace object in the Explorer window.
In the Properties window, locate the GlobalWind property and set an X, Y, and Z value for its direction and strength.
Particles emitted by a ParticleEmitter will follow the global wind vector as long as the emitter's WindAffectsDrag property is enabled and its Drag property is greater than 0. Fire and Smoke instances follow the wind vector by default.
To make it easier to tune global wind, you can use the Wind Direction widget, accessible from the View tab. The widget lets you visualize how wind is blowing using a "wind sock" model, and you can dynamically set the wind's Speed, Yaw, and Pitch by clicking the desired aspect name and sliding the slider along the bottom, or you can adjust yaw or pitch by manipulating the green ring and blue arrow on the animated portion. You can also click and drag the widget to reposition it anywhere in the 3D viewport.
Scripting of the GlobalWind property opens up a whole range of possibilities. For example, you can use the following code sample to cause cyclical gusts of wind that ease in and out using the math.sin() function.
Script - Cyclical Wind Gusts
local gustCycleDelay = 5 -- Max duration between gust cycles in secondslocal gustCycleDuration = 3.5 -- Duration of each gust cycle in seconds-- During each gust cycle, a portion of "gust" will be added to "baseWind" in a ramped fashionlocal baseWind = Vector3.new(5, 0, 2) -- Base wind speed and directionlocal gust = Vector3.new(25, 0, 10) -- Gust speed and directionlocal gustIntervals = 100 -- Number of iterations used to calculate each gust intervallocal dg = gustCycleDuration / gustIntervalslocal dgf = dg / gustCycleDuration-- Set global wind to base wind initiallyworkspace.GlobalWind = baseWind-- Wait delay amount before starting guststask.wait(gustCycleDelay)while true dofor i = 1, gustIntervals dolocal f = math.sin(math.pi * dgf * i) -- Use sin() function to ramp gustworkspace.GlobalWind = baseWind + f * gust -- Set global wind to base wind + gusttask.wait(dg)endworkspace.GlobalWind = baseWind -- Reset global wind to base wind at end of gust cycletask.wait(math.random() * gustCycleDelay) -- Wait a random fraction of delay before next gust cycleend