Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Question

Hi everyone, I have a problem with making a door. I know how to create a animation for it (I made an empty gameobject and used it as a rotation point). But It never works correctly, I tried so many diffrent scripts an tutorials but it never works. So, does someone know a easy script for open and closing a door?

 

Thanks

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hey there, i have one script and it supports sound.

Please login or register to see this code.

you have to attach on the object one Box Collider and mark it as Trigger, then make sure to tag your player as 'Player'

 

The player would be able to open the door when he is inside the collider so scale it as you want ;)

Edited by nightbird0

Share this post


Link to post
Share on other sites

  • 0

if you are not sure how to modify the script make an other one and with a boolean ' locked = false ' disable this script like " GetComponent<DoorScript>.active = !locked " and when you set the bool to true it would work

Edited by nightbird0

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...