Download

How to know if player is looking at a object?

Hello there!

I’m making a slide door that open/close when the player push a keypad. I have done the feature of open/close when the player press left mouse when entry in the keypad’s trigger, and I have setup a variable that indicate if the player can or not interact. The only thing left is do that the door only open and close if the player is looking directly at the keypad

You can see in the photo that the red circle indicate the keypad zone that must be seeing by the player to be able to open it, and the blue, the trigger inside the player must be in.

I have been trying do that with the trace line by channel, but it didn’t work. Also tried with multi line trace by object, etc. Any of them didn’t worked. I dont find the way to detect if the player is looking at the keypad.