not asking for code, just on where to start
I want to create a monster type of thing that when you look at him, he'll start moving your way, but I don't know how to do the first part, and I'm looking forward to learn how to start.
Thanks
You could use the function WorldToScreenPoint()
which is a method of Camera
. It takes in one parameter representing the 3D position that you want to test. It then returns two values: a Vector3
whose x
and y
properties represent the position on screen (the z
property of the Vector3
represents the depth of the 3D point relative to the screen) and a bool representing whether or not the 3D position is on the screen. For your purposes, the only value you need is the bool indicating whether or not the point is within the bounds of the screen. An example is demonstrated below:
function positionIsOnScreen (pos) local camera = workspace.CurrentCamera local _ , onScreen = camera:WorldToScreenPoint(pos) return onScreen end