matter-js
matter-js copied to clipboard
Calling Body.setStatic(body, true) twice will break the body
Body.setStatic
cannot be called consecutively with true
; this will blow away the part[i]._original
cache as it always does a replacement for the current values, even if they are reflective of a static body.
console.log("boxA.inertia = " + boxA.inertia); // 27306.666666666668
Matter.Body.setStatic(boxA, true);
Matter.Body.setStatic(boxA, true);
Matter.Body.setStatic(boxA, false);
console.log("boxA.inertia = " + boxA.inertia); // Infinity
Example file: setStatic2xBug.zip
Same problem here. The pushed fix doesn't really fix it (it does, but it breaks other things)