jcornaz / heron

[DISCONTINUED] An ergonomic physics API for bevy games
MIT License
293 stars 44 forks source link

Collider not despawning correctly during PostUpdate stage #246

Closed ottermata closed 2 years ago

ottermata commented 2 years ago

I've just started playing around with bevy and wanted to add physics to my test project. As I was changing things over I encountered a weird bug, where some physics objects were not being removed properly. I tried changing the hit detection over to the collision event listener, but that had the same issues. After moving the system around a bit the bug went away, but then there was no knock back effect when the projectiles hit the enemy.

I have created a short example showcasing the different behaviors here: https://github.com/ottermata/heron-collision-test These systems both suffer from the same issues:

When in the Update stage, the physics seem to be mostly ignored. Every now and then they slightly push or rotate the enemy. When in the PostUpdate stage, they push the enemy away and don't correctly despawn.

While I was creating that test I saw the Collisions component which seems to not have these issues, so I will probably just use that. (projectile_collision_check system)

It would be nice to know why the collision is being registered, without resulting in physics changes. Since it looks like a bug to me, I have opened this issue.

Maybe an example of how something like this is supposed to be implemented would be helpful for newcomers, feel free to use my code as a base for that.