0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-03-14 00:38:41 -04:00
This commit is contained in:
tylerfurtwangler 2024-11-27 16:05:09 +00:00 committed by GitHub
commit 7de01ea255
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -435,13 +435,14 @@ var Axes = require('../geometry/Axes');
// sum the properties of all compound parts of the parent body
var total = Body._totalProperties(body);
var positionDelta = Vector.sub(body.positionPrev, body.position);
body.area = total.area;
body.parent = body;
body.position.x = total.centre.x;
body.position.y = total.centre.y;
body.positionPrev.x = total.centre.x;
body.positionPrev.y = total.centre.y;
body.positionPrev.x = total.centre.x + positionDelta.x;
body.positionPrev.y = total.centre.y + positionDelta.y;
Body.setMass(body, total.mass);
Body.setInertia(body, total.inertia);