erincatto / box2d

Box2D is a 2D physics engine for games
https://box2d.org
MIT License
8.05k stars 1.51k forks source link

penetration when change fixtures #685

Closed jcyuan closed 2 years ago

jcyuan commented 3 years ago

there is a video clip to reproduce it: https://youtu.be/NfPkbFgw30g

as you can see, the "laser" shot, will blow the character away, in the blowAway status, i changed character's fixture by updating all vertices of each fixtures, and then called body.SynchronizeFixtures.

but as you can see, if i continusly call applyForce to character to let it run, and if now change it's fixtures, it will penetrate from walls....

i don't know what should i do to fix this, is the way i used to change the fixtures wrong?

there are some extra info: this box2d is a ported web version from c++ version: https://github.com/flyover/box2d.ts the game runs under 60+FPS so there is no low FPS problem. (with box2d 1/60 fixed update) but i still see some chances that small body will penetrate from edge shapes sometimes (if with a relatively big velocity), what is the potential problem will cause such penetration issue in box2d? i guess the issue in the video is caused by this too? or just i don't know how to change a fixture at runtime correctly?

appreciated if any help!