Hello! I want to make something like the eyes in the doors. I want to take damage to any player who looks at the part. And by saying when he look i don’t mean when the cursor on the part, i mean exactly when part is at least a little bit on the screen he will be taking damage. Also i want to check the FOV of player, beacuse if it will be small then player will be taking damage even when he don’t see the part (he would see it with classic FOV, but with small not) and when FOV will be big he will don’t be taking damage. Can somebody please help me???
The super lazy way(?) is WorldToViewportPoint which translates a 3D coordinate into a 2D coordinate that describes where on your screen the point is, how far away from your camera the point is and if the point is visible on your screen, so it’d be a matter of using the latter returned value.
I’m not smart enough to know the other mathematical ways of doing this such as through finding the relative coordinates of the player to the enemy and then getting the dot product between the enemy’s forward vector and the aforementioned relative coordinates.
Oh, thanks! Do you know how to check if part is not behind wall? Use raycast is not good way, beacuse as i know it’s makes ray from camera center to part center, but i need to know if we see at least a little bit of part that behind wall