I want to make a fuction, that the player have to look at a object and press E to interact with it.
Like if the player want to open this Fusebox, he must look at it before he can press E otherwise it should not execute my if statement to open the fusebox cover!
But how can I make a simple fuction like this? because I dont want to use only a collider trigger event because the player should look at the object with what he want to interact.
But how can I make this query that checks whether the center of the screen (where the crosshairs are) is exactly to look at the fusebox?
So that I can then ask in an if whether the player touches the collider of the Fusebox
(so he is close enough to it).
Additionally he is also looking at the fusebox and that he has pressed the “E” key to execute the if statement the open the Fusebox cover…