All of your doors open because you re not actually checking whether or not the hit object from your raycast is actually the door object your script is holding a reference to.
Sliding door script unity.
This is great for beginners who are looking i.
Door opening trigger in unity in this video i show you how to open a door with a trigger pressure plate.
Support watchfinddo media on patreon.
Gwyneth paltrow plays london publicist helen effortlessly sliding between parallel storylines that show what happens if she does or does not catch a train back to her apartment.
Unity 5 doors door unity 5 door doors in unity 5 door in unity 5 don t forget to copy and paste keys from dooropen animation for doorclose animation.
And in c you ve wanted some new content for a long time so i took an evening to make a few videos separate from unity for the community directly.
Make an empty gameobject and call it door drag and drop your door model into scene and rename it to body move the body object inside door add a collider preferably spherecollider to door object and make it much bigger then the body model mark it as trigger assign this script to a door object the one with a trigger collider make sure the main character is tagged player upon walking into trigger area the door should open automatically using.
They re a little rougher than my usual ones but here s one of the first few a quick overview of making automated doors for your games.
Watch and learn on how to create an automatic sliding door in unity.
Script lays down here.