Quick answer: Compute the knockback direction at the instant of the hit using the current positions of attacker and target, or use the hitbox's contact normal.

If knockback launches enemies sideways or backward into you, the direction is from a stale position. Computing it on impact fixes the push direction. Here is how.

How to fix it

1. Compute direction on hit

In the hit handler, use (target.global_position - attacker.global_position).normalized() with current positions, not a value cached when the swing began.

2. Or use the contact data

When available, derive the push direction from the collision normal or the hitbox's facing at the moment of contact for more consistent results.

3. Apply once per hit

Apply the knockback impulse in the same place you apply damage, so direction and force always come from the same up-to-date contact event.

Catching the ones you can't reproduce

The hardest version of this to fix is the one you can't reproduce — it only happens on a player's hardware, OS, driver, or save state, under conditions that simply aren't present on your machine. A report that says “it crashed” or “it froze” gives you nothing to act on, so the bug survives release after release while quietly costing you players.

Automatic error capture closes that gap. Each failure arrives with its full stack trace, the device and OS, the build number, and a breadcrumb trail of what the player did right before it broke, so even a failure you have never seen becomes a specific, reproducible issue. Fold identical failures into one signature ranked by how many players each hits, and your worklist sorts itself worst-first instead of arriving as a stream of vague complaints.

This is where a tool like Bugnet earns its place. Its SDK captures every Godot error automatically with the full stack trace plus device, OS, memory, build, and game-state context, folds duplicates into one grouped issue with an occurrence count, and ties each to the build it first appeared on — so you fix the problem that hurts the most players first and confirm it is gone when its signature disappears from the next release.

The bug you can't reproduce isn't gone — it's just invisible until you capture it from the player's device.