Make objects visible in a specific direction/area

Hi all! I’am trying to create a submarine mini-game project. But now I’am completely stuck with making sonar. Idea is simple: you press some key and some objects became visible (not spawned!) in specific direction (or area). I tried to use nodes but can’t find solution.
Can someone give me any advice how to do that?

Hi and welcome!

For the detection of objects in a specific direction, you could use something like a cone angle based detection system. This is quite simple and can be done with dot product of direction vectors.

Here I made a simple example for this. You try it online here. Use W, S, A, D to move around, Q, E to rotate. When the cone encloses an object, it changes color.

You could also download the files from here

Some resource about dot product for detection:

3 Likes

This is a great solution. Big thanks!

1 Like