Hey guys.
I'm facing a major issue, and I've done quite a bit of research about it. If you look at the 2 gifs in the thumbnail, the first is the actual behavior I'm experiencing, and the second is what I want. The reason this is happening is because as the red enemy charges the player, it intersects, but then only next frame (when it's still intersecting) is the first collision reported and the knockback (once again, shown in the second gif) applied. However, it's still overlapping by now, which means a second, false report is being generated which causes damage and knockback to be applied twice, and this causes the sudden decceleration I'm experiencing in the first gif.
Having done quite a bit of research on this, my understanding is that there's not really any good options to have instant collision detection---at all.
What I've tried
-
I've been told using shapecast (with force_shapecast_update) works, and it did... with a stationery area2D on the receiving end. The moment the area2D started moving, the shapecast, even with force update, would detect it one frame late. Since both the enemy and the player are going to be moving frequently, this is not an option.
-
I've also seen that using Rect2 is a good option, but the issue with this is that it's axis-aligned, and only in the rectangle shape. In my game, I will need more complex shapes than a rectangle, and I will need to be able to rotate them. Rect2 is not a good option for me (I've seen some stuff about combining it with a transform2D to rotate it... but when I tried, it did not rotate at all. Let me know if there is something more I'm missing here though)
-
I've also tried other hacky workarounds in my code... none of them worked, nor would I really want hacky workarounds in my code in the first place.