Hi , i’m learning about scripting past 2 weeks and i still can’t complete my script . I want to make script who allow’s you to interact with world . I explain that : i start game , fps - i want to go to doors and when i aim to button i want to press f to open them or i want to open box with alarm and click that button to start alarm. My problem is , i can’t write a script who allows me to interact with raycasting . Anyone can help me or give a link to guide ? Please for Anwser
(so sorry for my bad english )
Do you have any code to share? What have you tried?
I’d suggest taking a look at this: Unity - Scripting API: Physics.RaycastAll
Raycast in the direction the camera is looking, check all the hits if one of them is the door and then you can do whatever you want.