0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-31 18:14:55 -05:00

Set part.angle in Body.update.

This change fixes a discrepency between `Body.setAngle` and `Body.update`.

Calling `part.angle` should always return the world space angle of the part.

In `Body.setAngle`, `part.angle` is correctly updated for every part.
This maintains the invariant.

In `Body.update`, `part.angle` was previously not being updated.
This led to stale values returned for `part.angle`.
This commit is contained in:
Kenneth Rose 2016-10-04 18:48:41 -04:00
parent ee336863f7
commit a36c6a6593

View file

@ -573,6 +573,7 @@ var Axes = require('../geometry/Axes');
Vertices.rotate(part.vertices, body.angularVelocity, body.position);
Axes.rotate(part.axes, body.angularVelocity);
if (i > 0) {
part.angle += body.angularVelocity;
Vector.rotateAbout(part.position, body.angularVelocity, body.position, part.position);
}
}