Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I make a method that will check whether a certain part is within your sight?

Asked by 10 years ago

Is there any possible way to know whether a part is within your line of sight? I have looked around in the Wiki, and I haven't found anything of the sort... So if there is any way to create a method that can detect objects within your sight (detect whether the player can see the object or not), that'd be nice to know! Thanks in advance!

0
This idea reminds me of that slender game, it's pretty good imo. Why not shoot a pm to the creator? yurhomi10 192 — 10y

1 answer

Log in to vote
2
Answered by
OniiCh_n 410 Moderation Voter
10 years ago

Try using raycasting. If you're in first-person, have rays cast off of the Player's head in the directions of their field of view. If the rays hit an object, like a part, then it means it is within your field of view. Make sure the rays cast in visible areas, and nowhere else. That's my way of solving this, but since I don't know much about the Raycasting API, you'll have to resort to the wiki for more information on how to do this.

This is the best way to do it in my opinion, but there are many other ways, and I encourage you to explore more before coming to a decision.

1
I'll take a look into it, thank you ;) NutsNWaffles 135 — 10y
Ad

Answer this question