I am making a game in Unity. I have an object e.g. cube. I want to release air from it like fan so that when other cubes come closer, it throws them away. What velocity,force etc I will need to do that?
migrated from physics.stackexchange.com May 21 '13 at 8:04
This question came from our site for active researchers, academics and students of physics.
While the aerodynamic effects caused by a fan can be quite complex to model accurately, it is sufficient for most cases to model the force it applies after the Inverse-Square Law.
It means that the force it applies to another object is divided by the distance multiplied with itself.
Another factor you could or could not model depending on how physically correct you want to be is the wind drag of the objects which are pushed by the fan. Wind drag means that objects with a large surface exposed to the wind direction receive more force from the wind than those with a smaller surface (again, overly simplified. The aerodynamics are a lot more complex in reality). When you want to model this, you also need to multiply the force with the surface area of the object which is pushed.
The complete formula would then be:
There is, however, a pitfall in this formula: it has a singularity when the distance is 0. When the distance is below 1, the force will be more than the intended maximum. When the distance gets very small, the force can become extremely strong. This could lead to quite glitchy behavior. To fix this issue, add 1 to your distance calculation, or cap the distance at 1:
More accurate results could be reached by an actual physical simulation of aerodynamics, but this is a highly complex field, both in regards to development time and computational resources. Unless physically accurate aerodynamics are a core gameplay-element of your game, it is unlikely to be worth the hassle.
You could simply calculate the distance ( you can use any mesh for collision clipping to represent the "air flow" limits), the closer it gets the higher the force you apply to it in that direction. Of course this isn't as accurate, but you could add noise to the direction of the velocity.