Category: Unity 3D

Auto-Aiming in 3D Space Using Player’s FOV

In this tutorial we take a look at using a player’s field of view (FOV) to detect whether or not it can see an enemy. If the player can see the enemy then they automatically aim towards it.

This is achieved by attaching a simple script to the part of the player that needs to rotate towards the enemy and letting it know what the enemy GameObject is, where the FOV should eminate from, the speed of the rotation and the angles that limit the FOV .

Play test the demo scene online here.

Continue reading