In this short video you will get to understand how you can use rays and raycasting for your games to make NPCs’ behaviours more realistic and, for example, trigger a specific behaviour when an object or another character is in their line of sight.
We will look at:
- Creating a ray from the NPC.
- Casting a ray for debugging
- Get the NPC to follow the player if the player is in front