How to make a door switch scenes

Hi I am trying to code a game to where when I push ‘E’ on a door it switches scenes, but all of the tutorials Ive tried to follow all use mouse click or touchscreen, and Im not experienced enough to know how to substitute the code lines. Asking for help

Hey, you can look at the following keyboard input tutorial to learn how it works
https://developer.playcanvas.com/en/tutorials/keyboard-input/

Updated the changing scenes example to change scene on key press “e”
https://playcanvas.com/project/878422/overview/changing-scenes-using-e

Thank you! But im still having trouble trying to make this function only when I am looking at the door.

I would suggest to use a raycast to check if the player is looking at the door at the time player presses the “e” key, so as he presses the e key, you can do a raycast from the player camera, in the direction the player is facing and check if the result returned by the raycast is a door and then switch the scene.

https://developer.playcanvas.com/en/user-manual/physics/ray-casting/

Hey, I tried this and I can’t quite get it to work, I might not be doing it right but I’m not for sure.