openfl / box2d

Haxe port of Box2D, a popular rigid-body 2D physics engine
Other
96 stars 29 forks source link

Features and fixes from base box2d #31

Open kmgb opened 3 years ago

kmgb commented 3 years ago

This PR includes 3 changes that the base box2d project has adopted:

  1. Wake B2Body on setLinearVelocity or setAngularVelocity: Currently, if one of these functions is called on a sleeping body, the body remains stationary. The solution is to wake bodies when either of these functions are called with non-zero values.

  2. Change restitution threshold to be per-fixture: This replaces the global setting b2_velocityThreshold with a per-fixture setting that allows for customization of the cutoff velocity for elastic collisions.

  3. Fix B2Body setActive(true) first frame: This ports a simple bugfix for setActive(true) on a B2Body not considering collision for that body on the first frame