From f428d6be58843559127fc20edd9978ec0b76e238 Mon Sep 17 00:00:00 2001 From: liabru Date: Thu, 7 Apr 2016 19:50:07 +0100 Subject: [PATCH] fix Body.scale for circles, closes #234 --- src/body/Body.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/body/Body.js b/src/body/Body.js index 9fe07d8..f2e378d 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -505,6 +505,16 @@ var Axes = require('../geometry/Axes'); Bounds.update(part.bounds, part.vertices, body.velocity); } + // handle circles + if (body.circleRadius) { + if (scaleX === scaleY) { + body.circleRadius *= scaleX; + } else { + // body is no longer a circle + body.circleRadius = null; + } + } + if (!body.isStatic) { var total = _totalProperties(body); body.area = total.area;