Saturday, May 4, 2013

Air Resistance in Box2D

I've seen many questions asking how to implement air resistance (drag) in box2d, and the most common solution is to use body.setLinearDamping.  After just a little bit of research, I discovered that calculating air resistance is not that difficult.  Here is an example in Java using box2d.
Note: this is not a full simulation of aerodynamics, it only affects linear velocity.
After reading the source, check out the algorithm in action in this video.

No comments:

Post a Comment