Door Detection
When setting up the doors in your game, you should add the Door Detection component to your player. This component allows the player to detect doors in your scene. It ray-casts continuously and checks what objects are in front of him/her.
Detection Component
In the detection component, you have a reach variable. This variable determines how close to the door the player needs to be in order to be able to move it. You can display a visualization of that 'reach' in your scene if you'd like to.
There are also some slots where you can put text-prefabs that will be shown whenever a certain stage of the rotation is reached. For example you could display 'Press "E" to open' whenever your player is looking at a door. You can also leave these slots empty.
Warning
Make sure the 'Reach' variable is not set to zero.'.
Prefab | Description |
---|---|
Looking at | Does the object that entered the trigger zone have a certain tag? |
In Zone | Does the object that entered the trigger zone has a certain name? |
Chrosshair | Is the player looking at a certain object? |