- Home /
Use Button
Hello again Gr4v1ty here and I am wondering, can You have it so that you have to look at a box collider and hit "e" instead of pressing "e" from anywhere?
Answer by xt-xylophone · Apr 05, 2013 at 04:12 AM
Pretty vague question.
But you could use a combination of tags on your button as well as a raycast from the player's face. If that ray hits an object with your button's tag then you know it was look directly at the button. A raycast can also have a range so then the player wont be able to use it from across the world haha.
If precision isnt too much of an option, some trig could figure it out to, like is the player near the button, at the right height and facing the right way. Theres a lot of ways to do this. Try googling around a bit
Your answer
![](https://koobas.hobune.stream/wayback/20220613095724im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer
C# Capture Keypress 3 Answers
Door rotate on hinge 1 Answer
Show and unlock mouse on key press 1 Answer