Spy backstab detection mechanics illustrated @sigsegv-mvm
Spy backstab detection mechanics illustrated  @sigsegv-mvm
Uploaded October 2016 | Updated November 2026, 23 hours ago
Whether or not a particular knife attack is a backstab is determined by the result of three vector dot products. This video should help show visually how all of this stuff operates, even for people who don't know what a "vector" or "dot product" is.

In the first video segment, the yellow vector is the horizontal part of the spy's aim direction ("SpyView"); the magenta vector is the horizontal part of the heavy's aim direction ("VictimView"); and the cyan vector is the horizontal part of the vector pointing from the middle of the spy's hull/bbox to the heavy's ("DeltaPosition").

The threshold between being considered "behind" or "in front of" the victim is when you're standing side-by-side, directly to the right or left of the victim (as if you're standing centered on a line extending out from the middle of the victim, perpendicular to their aim direction).

One curious finding is that as long as you're behind (see definition above) the victim, you can actually be facing slightly to their rear (17.5 degrees past perpendicular) and still score a backstab. This is best demonstrated in the beginning of the third video clip (at 3:20).

Since the vertical component of all the vectors involved is ignored, arguably-stupid things like backstabbing people while on top of them are possible. Because of the "behind" rule, it's only possible on the back half of their hull; and the other requirements become slightly more constraining than when you're on the ground beside the victim.

Yes, I know, it looks like the spy is trying to take a dump on the heavy's head in the fourth video clip. That's just what the duck animations do when you start and stop moving. Deal with it and leave your stupid comments to yourself.

Here's another very good analysis of spy backstab mechanics that's worth reading if you haven't seen it before. It's not 100% accurate about everything (e.g. the spy's aim direction does actually matter, and there's a hard 107.5 degree limit on reverse-direction stabs) but it's still largely correct and has some good diagrams and explanations:
technofovea.com/blog/archives/278

And here's what the actual code for backstab determination looks like:
gist.github.com/sigsegv-mvm/bda5c53af428878af6889635cd787332
Spy backstab detection mechanics illustratedTFBot weapon-specific aim quirksServer mod: fix for 10-second wave countdown sounds20150924: Valve also broke FaN knockbackEngiebots in squads on maps without engie nest hintsServer mod: robo sapper voice linesTank dynamic path branchingServer mod: kill bots before forcing-to-spectator-teamShortstop shove third-person animations (20% speed)Server mod: allow holiday-restricted items all the time[Raw: 2/2] Airblast-vs-Players: Vectors + Cone (essay in description)Iron Bomber fuse time reduction in MYM makes jumping easier
sigsegv |

Spy backstab detection mechanics illustrated

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER