# Attempting to implement a directional blocking mechanic.

**URL:** <https://forums.unrealengine.com/t/attempting-to-implement-a-directional-blocking-mechanic/767342>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [February 9, 2023, 3:10pm UTC](https://forums.unrealengine.com/t/attempting-to-implement-a-directional-blocking-mechanic/767342 "2023-02-09T15:10:05Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 9, 2023, 3:56pm UTC](https://forums.unrealengine.com/t/attempting-to-implement-a-directional-blocking-mechanic/767342/4 "2023-02-09T15:56:51Z")

</div>

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

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/b/b/dbbe5953d3a6f5c7efea86b5e5bc0c30499addaa.png)

> Dot Product XYZ (Vector 4)

3d vector swill do:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/5/6/856acc8cfeff0f9237642eeaff69cac65c1df705.png)

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/d/3/dd3b2e40a87dfbe75661385e5531591fbee12308.png)

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

* * *

a thread with relevant examples:

> [@How to create God of War targetting system?](https://forums.unrealengine.com/t/how-to-create-god-of-war-targetting-system/210302/2):
>
> [The Dot Product](https://en.wikipedia.org/wiki/Dot_product) of 2 directional vectors will be in range of -1 to 1. Anything that’s above 0 is in front of you, anything below 0 is behind (and every other value in between matters, too!) I grab all the actors around the player using a Sphere Overlap (as in the original suggestion) and loop through the elements of the array, checking my angles - Dot player’s forward and the direction to each target. For dot values greater than .5 I mark the target, and add that actor to the array…

---

_[View the full topic](https://forums.unrealengine.com/t/attempting-to-implement-a-directional-blocking-mechanic/767342)._
