Attempting to implement a directional blocking mechanic.

Imagine the big cube at the top is the enemy attacking the player:

Dot Product XYZ (Vector 4)

3d vector swill do:

image

Use 3d if you’re expecting to be attacked from above / below, too. If you’re game is flat, you could get away with 2d.


image

Print this to get the feel of what dot is doing.


a thread with relevant examples: