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

This commit is contained in:
Richard Davey 2024-01-31 20:32:10 +00:00
parent 425ef3b472
commit cf27547793

View file

@ -741,6 +741,8 @@ var Axes = require('../geometry/Axes');
point = point || body.position; point = point || body.position;
var wasFixedRotation = (body.inertia === Infinity) ? true : false;
for (var i = 0; i < body.parts.length; i++) { for (var i = 0; i < body.parts.length; i++) {
var part = body.parts[i]; var part = body.parts[i];
@ -792,6 +794,11 @@ var Axes = require('../geometry/Axes');
body.circleRadius = null; body.circleRadius = null;
} }
} }
if (wasFixedRotation)
{
Body.setInertia(body, Infinity);
}
}; };
/** /**