From a36c6a659389efbd89b4e760414319d12528d6f4 Mon Sep 17 00:00:00 2001 From: Kenneth Rose Date: Tue, 4 Oct 2016 18:48:41 -0400 Subject: [PATCH] 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`. --- src/body/Body.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/body/Body.js b/src/body/Body.js index 36a8c81..79e5676 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -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); } }