diff --git a/src/body/Body.js b/src/body/Body.js index 3bdc75c..9a40d0c 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -82,7 +82,8 @@ var Axes = require('../geometry/Axes'); xScale: 1, yScale: 1, xOffset: 0, - yOffset: 0 + yOffset: 0, + lockRotation: false } }, events: null, diff --git a/src/render/Render.js b/src/render/Render.js index 7888226..3510eef 100644 --- a/src/render/Render.js +++ b/src/render/Render.js @@ -742,7 +742,9 @@ var Mouse = require('../core/Mouse'); texture = _getTexture(render, sprite.texture); c.translate(part.position.x, part.position.y); - c.rotate(part.angle); + // rotate sprite if not lockRotation + if(!part.render.sprite.lockRotation) + c.rotate(part.angle); c.drawImage( texture, @@ -753,7 +755,10 @@ var Mouse = require('../core/Mouse'); ); // revert translation, hopefully faster than save / restore - c.rotate(-part.angle); + + // rotate sprite if not lockRotation + if(!part.render.sprite.lockRotation) + c.rotate(-part.angle); c.translate(-part.position.x, -part.position.y); } else { // part polygon