# How to tell if the player is looking at an object in the center of the screen

**URL:** <https://forums.unrealengine.com/t/how-to-tell-if-the-player-is-looking-at-an-object-in-the-center-of-the-screen/488003>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [August 25, 2021, 6:14pm UTC](https://forums.unrealengine.com/t/how-to-tell-if-the-player-is-looking-at-an-object-in-the-center-of-the-screen/488003 "2021-08-25T18:14:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [August 25, 2021, 6:43pm UTC](https://forums.unrealengine.com/t/how-to-tell-if-the-player-is-looking-at-an-object-in-the-center-of-the-screen/488003/2 "2021-08-25T18:43:24Z")

</div>

![347333-screenshot-4.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/8/6/686331e16528c4d0e5bc80908b569b8212e41c91.png)

Dot Product. The range is from -1 to 1. Negative values are behind you.

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/d/f/cdfdf23999e5d45c8a385203c6e8d92e990511ad.gif)](https://gyazo.com/f7dfb068b4eb4571adbb49173d3fb9f2)

More info in this post.

> [@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/how-to-tell-if-the-player-is-looking-at-an-object-in-the-center-of-the-screen/488003)._
