- Home /
How do I create 2D swirling wind patterns? (Use fluid dynamics?)
Hi guys,
We're making a 2D game and I want to test some 2D wind patterns which will swirl in different directions (so, not a simple horizontal directional windzone, but involving curves).
A good visualization for it is this Van Gogh painting:
... Imagine a player surfing along these wind currents in the air. The wind current should therefor be able to effect GameObjects physics (the player).
So, I'm not sure how to achieve this. I've been looking at fluid dynamics with directional force applied, but I'm not sure if that's going to allow the same 'feel' as wind. I've also looked at adding force along a spline bezier curve, but I'm not sure this makes sense.
How would you guys go about this? What should I research in order to get something like this working?
Also, it would be ideal if I could randomize these wind currents, but I realize that may be just complication things.
Thanks for reading!
So the player "surfs" along these wind currents. Is the player following the lines of the wind? Is the player "stuck" to these lines until they explicitly wish to "jump off"?
I kind of have an idea of what you want, but at the same time, I'm totally lost. Does the player have a parachute that is controlled by these currents? Or do they function a lot like Line Rider?
Hi Broccoli,
$$anonymous$$ind of neither. Ins$$anonymous$$d imagine a bird riding a wind current. They cruise along the wind and the wind pushes them in a certain direction, but if they flap they can get out of this current. (The player should feel 'funneled' along the wind current, but they can use the controls to exit if desired.)
They are not 'stuck' on this wind current, but imagine that the current is somewhat magnetic and has a slight force keeping them within the current, but they can break free of it as well.
Does that help? The key analogy is a bird riding a wind current.
That definitely clears a lot up.
I don't think there is anything in Unity that will give you this functionality out of the box.
What I think you'll want to do is encapsulate your own WindWave object or something. An object that encapsulates that WindWaves path through your game, and the "magnetic" property of that line.
The WindWave as I picture it has:
A line that denotes its path through the Scene
A width of "magnetic force" that effects the area evenly on both sides of the line
A strength of this "magnetic force"
Generating the line is your hardest part I suppose, it isn't quite a bezier curve as that seems to rigid for your needs, although this website seems like it might be helpful anyway, bezier curves might not be out of the question.
You could break up the generation of a WindWaveLine into general subroutines that draw PARTS of the WindWave, so a straight part, a curved part, a looped part, a looped part that goes down, a eliptical loop, etc. You could procedurally generate these different parts and put them together according to a set of rules, then draw the corresponding line onto the scene. You could get a more realistic feel by applying some trigonometric functions I suppose.
I'm kind of just talking out loud here. It's definitely an interesting problem and one that is going to require a lot of thought.
Hopefully I helped you out a bit.
Your answer
Follow this Question
Related Questions
Enemies in top down shooter being affected by physics of bullet 1 Answer
question about trees 1 Answer
Swipe Wind 2 Answers
Wind zone particle system exclusion possible? [shuriken] 0 Answers
Animated clothes 1 Answer