Wind Generation

Question: is it possible to generate wind that can move objects, including players?

I would like to create a section in my game(s) where players or objects located in an opened area, at a specific altitude, be pushed or moved around based off the direction of the wind. I have created something similar to this, but it was only an animation that affected the player’s speed. I’m fully aware that you can use a moving system that transports humanoids by using push force or other various functions, but that’s not what I am searching for.

What I am looking for: Generated wind that has different direction and speed. A wind that can also move and/or pick up items and players.

(I would prefer not to use anything in the provided image)


P.S. I have not attempted to search nor use any plugins for this topic.

3 Likes

Is there a reason as to why?

You can use a BodyVelocity with enough velocity to make them push a player.

1 Like

The reason is, I have had many complications while using BodyVelocity, and other forces that Roblox Lua provides. I have also run into many bugs on the way, the majority of them are fixed after Roblox releases a new Studio update, but that decreases the amount of time I have available to complete a certain task.

Well you can have a global wind value which is just a direction and phase this in the higher up you are. You can then apply a force using a BodyForce which is a multiple of this value. BodyVelocity is not a good idea since wind is essentially just a force, not a constant velocity applied to objects.

Your wind direction is easy to get and you can even use TweenService to change this slowly over time. To get a direction, pick a random vector like so: Vector3.new(math.random()-0.5, math.random()-0.5, math.random()-0.5)*windStrength

This will randomly pick wind strength in each direction.

You can simply tween each wind value in over a span of 5 seconds or so, or slower if you’d like.

To phase in your wind, apply a Lerp to your BodyForce’s Force value based on the height of the player using an alpha which is the percentage of the player’s height to the target height.

For example: thisWindForce = Vector3.new():Lerp(globalWindForce, math.max(target.Position.Y+floor, 0)/(windHeight.Position.Y+floor))

Your floor value is simply the height at which no wind occurs. The rest is self explanatory.

BodyForces are more reliable than you think and repeatedly setting Velocity (even on Heartbeat) will cause very weird physics behavior and involves unneeded math.

Your wind can now blow up, down, forward, backward, left, and right at different strengths and will become more violent the higher you travel.

7 Likes

I’d create a two 3D noise models with two or three octaves using math.noise(x, y, z). Each model will provide the x and z components of the wind force at a given position. That way, some areas have stronger wind than others. You can make a VectorForce for every object that isn’t anchored and update the force when the object moves more than a threshold distance. If you want the wind to go up/down then you can make another noise model for the y component.

If you want the wind to change over time, then you can make each model 4D by multiplying math.noise(x, y, z) by math.noise(time).

Not using VectorForce is crazy. Use it, and love it xD

3 Likes

There we go, I created a workable wind force. ClassName = Part.

2 Likes

It only seems to work when you jump.

1 Like

It does work on ground too. You need to adjust ground part friction.