From b421c38f74cb66a00335314a022ce57018a2122d Mon Sep 17 00:00:00 2001 From: liabru Date: Mon, 31 Mar 2014 11:38:43 +0100 Subject: [PATCH] optimisation for non-rotating bodies --- src/body/Body.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/body/Body.js b/src/body/Body.js index 0ab4346..4cc9d2d 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -213,8 +213,10 @@ var Body = {}; // transform the body geometry Vertices.translate(body.vertices, body.velocity); - Vertices.rotate(body.vertices, body.angularVelocity, body.position); - Axes.rotate(body.axes, body.angularVelocity); + if (body.angularVelocity !== 0) { + Vertices.rotate(body.vertices, body.angularVelocity, body.position); + Axes.rotate(body.axes, body.angularVelocity); + } Bounds.update(body.bounds, body.vertices, body.velocity); };