Global Wind

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.

Global Wind Vector

Global wind is controlled through The GlobalWind vector is a property of Workspace and you can edit it directly in Studio, or set it through scripting.

To set the global wind vector in Studio:

  1. Select the top-level Workspace object in the Explorer window.

    Workspace object shown in Explorer window of Studio
  2. In the Properties window, locate the GlobalWind property and set an X, Y, and Z value for its direction and strength.

    GlobalWind property shown in Properties window of Studio

Particle Influence

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.

Drag and WindAffectsDrag properties shown in Properties window of Studio

Wind Direction Widget

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.

Wind Direction tool indicated in View tab of Studio Wind Direction widget showing in 3D viewport of Studio

Scripted Effects

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 seconds
local 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 fashion
local baseWind = Vector3.new(5, 0, 2) -- Base wind speed and direction
local gust = Vector3.new(25, 0, 10) -- Gust speed and direction
local gustIntervals = 100 -- Number of iterations used to calculate each gust interval
local dg = gustCycleDuration / gustIntervals
local dgf = dg / gustCycleDuration
-- Set global wind to base wind initially
workspace.GlobalWind = baseWind
-- Wait delay amount before starting gusts
task.wait(gustCycleDelay)
while true do
for i = 1, gustIntervals do
local f = math.sin(math.pi * dgf * i) -- Use sin() function to ramp gust
workspace.GlobalWind = baseWind + f * gust -- Set global wind to base wind + gust
task.wait(dg)
end
workspace.GlobalWind = baseWind -- Reset global wind to base wind at end of gust cycle
task.wait(math.random() * gustCycleDelay) -- Wait a random fraction of delay before next gust cycle
end