How to simulate wind?

What’s the best way to add wind to a physics world? [import]uid: 52127 topic_id: 9641 reply_id: 309641[/import]

If I’m reading this correctly, rather than pointing gravity down, you could point it down and left/right - if that makes sense.

There are other ways of doing it but that would give the feeling of waking against the wind, which I assume is what you want this for. (That or blowing floating objects, in which case this would also work.)

Peach :slight_smile: [import]uid: 52491 topic_id: 9641 reply_id: 35186[/import]

I would use applyForce, probably fired by a timer.

Here is what I called a draggable fan demo:
https://developer.anscamobile.com/forum/2010/10/21/simple-draggable-fan-demo

That, in a nutshell, is a point you can move around which simply pushes any dynamic object away from it using a radial application of force. It could very easily be modified to push in a single direction - that would actually be much simpler code.

Generally, the process would be to have a sensor object and a timer. Whenever the timer fires it applies force to anything in contact with the sensor. [import]uid: 8271 topic_id: 9641 reply_id: 35188[/import]

@ horacebury
Thanks, a fan would be great. I’m going to try your code. [import]uid: 52127 topic_id: 9641 reply_id: 35252[/import]

@peach
True, doing this:

physics.setGravity(-1, 10)

will push things to the left. The problem is that I only want the wind to affect the player, and not every physics object on the screen.
[import]uid: 52127 topic_id: 9641 reply_id: 35250[/import]

Apologies; when you said apply wind to a physics world I assumed you were looking for a way to effect everything - Horacebury is right on if you’re just doing the player :slight_smile: [import]uid: 52491 topic_id: 9641 reply_id: 35255[/import]