From cf2754779328b0c65ecdc11391e6711e5f175770 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 31 Jan 2024 20:32:10 +0000 Subject: [PATCH] The `Matter.Body` function `scale` has been updated so if the Body originally had an `inertia` of `Infinity` this will be restored at the end of the call. This happens if you set a Matter Body to have fixed rotation. Fix #6369 --- src/physics/matter-js/lib/body/Body.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/physics/matter-js/lib/body/Body.js b/src/physics/matter-js/lib/body/Body.js index 61230e033..cb668ed6b 100644 --- a/src/physics/matter-js/lib/body/Body.js +++ b/src/physics/matter-js/lib/body/Body.js @@ -741,6 +741,8 @@ var Axes = require('../geometry/Axes'); point = point || body.position; + var wasFixedRotation = (body.inertia === Infinity) ? true : false; + for (var i = 0; i < body.parts.length; i++) { var part = body.parts[i]; @@ -792,6 +794,11 @@ var Axes = require('../geometry/Axes'); body.circleRadius = null; } } + + if (wasFixedRotation) + { + Body.setInertia(body, Infinity); + } }; /**