How to check if a part can see another part?

I’ve recently been playing a lot of breaking point! I decided it might be a fun project to do some sort of Ai system such as you find in breaking point, where if a guard sees you, he/she will become suspicious. The problem is, I’m not sure how I would check if the guard can actually see the player. At first I thought of having a part attached to the guard with a script that triggers when a player touches the part. The problem with this is that the part would detect the player through walls.

I need a simple way of going about this if there is a way. If I’m right in saying it has something to do with raycasting?

Thanks for reading :slight_smile:

1 Like

You can use the Dot product to check if something can see another thing. I recommend watching @okeanskiy’s tutorial on it since it is simple and teaches you the basics of how to use it

2 Likes

Thanks I’ll check it out! :slight_smile:

Worked perfectly! Thank you so much! :smiley:

I’m so glad that it worked out for you! If you have anymore issues please don’t hesitate to make another post about it!

1 Like

Is this dot thing with the NPC other client sided?

In the case of the video I believe it is, yes!