I’m working on a simulation toy, and I want to model wind on my world/levels.
I’m currently using playrho (a box2d fork) with gravity set to 0 to model a top down view.
I assume the wind will be represented as a vector field. But I’m unsure what method to use to get this field.
Could someone point me in the right direction? Should I be looking at the navier-stokes equation? Does anybody know of any relevant tutorials?
Thanks in advance!
Well, firstly you need to decide how accurate you want your wind modeling to be, but generally, the less complicated an equation you can use for your desired level of accuracy, the better. It’ll end up being a vector field, but I would probably make simple rules for how the wind interacts with objects in a given tile and the tiles around it, rather than trying to model fluid dynamics precisely.
Another approach might be a ray-tracing style approach, where the rays can bounce off object geometry and lose some momentum, objects can respond to ray impacts and gain momentum, and you do some vector math to figure out what happens when rays and moving objects intersect.
The exact approach depends on the specifics of your game, and the “right” answer might be neither of these.