matter-js icon indicating copy to clipboard operation
matter-js copied to clipboard

Calling Body.setStatic(body, true) twice will break the body

Open jmfd opened this issue 6 years ago • 1 comments

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

jmfd avatar Aug 02 '18 02:08 jmfd

Same problem here. The pushed fix doesn't really fix it (it does, but it breaks other things)

fserb avatar May 22 '21 21:05 fserb