You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating to the latest version (0.20.0) i have an issue where when i switch my body from static to dynamic with Matter.Body.setStatic(ball, false); it disappears. When looking at the body it seems like the values of its properties are set incorrectly. The body seems to be still there because the collision logic still triggers. I think the body just shoots off outside of view.
When adding the body with isStatic: false it spawns and behaves as it should.
0yz
changed the title
Body stops rendering when switching from static to dynamic
Body properties are incorrect after switching from static to dynamic
Jul 4, 2024
See this Stack Overflow snippet for another reproduction of the issue. The snippet is currently running 0.19.0. When the box hits the static platform, the platform falls when struck by disabling static with Matter.Body.setStatic(wall, false). Behavior is as expected. But if you bump the version to 0.20.0, the platform disappears when struck, a clear bug.
Just ran into the same issue with version 20. I saw that the Body.setStatic = function(body, isStatic) on line 1887 of matter.js v20 has a line of code that is causing the issue. After I removed if (!part.isStatic) { the shapes worked as before; if the shape changed to non-static it retains its properties, This avoids the conditional check that could skip setting isStatic properly.
After updating to the latest version (0.20.0) i have an issue where when i switch my body from static to dynamic with
Matter.Body.setStatic(ball, false);
it disappears. When looking at the body it seems like the values of its properties are set incorrectly. The body seems to be still there because the collision logic still triggers. I think the body just shoots off outside of view.When adding the body with
isStatic: false
it spawns and behaves as it should.I really don't know where to go from here.
Here is a basic example of the issue:
The text was updated successfully, but these errors were encountered: