This script worked for me but I am having trouble using it for another door. Any suggestions on how to do it. I can’t seem to activate my door once I already clicked my object
Could anyone advise me on what should I do to leave the door open after the function is triggered? If the door is open, then it opens again upon a secondary press of "E".
Hey, for some reason when I press E it always opens no matter what. I tried turning the collides and triggers off and on but it still doesn’t work right
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PickKey : MonoBehaviour { public Component doorcolliderhere; void OnTriggerStay() { if (Input.GetKey(KeyCode.E)) { doorcolliderhere.GetComponent().enabled = true; } } }
Couple of things might be miss-placed, the size of the box collider on both sides of the colliders(player/key), you might want to specify the collider , the on trigger method involves the collider of the game object where the script is and the "other" thats the target collider, you can place an if to specify the "other" collider with the key.
I was about to lose my sanity and then this video helped me!
THANK YOU!!!!!
Its so begginer friendly and i love it!
Thank you!
if someone is having trouble rotating hinge and door, change 'center' to 'pivot' under top screen.
thanks i got stumped on this for a bit
thank you so much
Great tutorial! It worked perfectly.
the hingehere dosnt work for me
where i can get the character package
How can i close the door?
You are the best i will never forget your help
Thank you so much! This is what I needed for my project.
This script worked for me but I am having trouble using it for another door. Any suggestions on how to do it. I can’t seem to activate my door once I already clicked my object
and if i want to close it again?
it's didn't work??
Could anyone advise me on what should I do to leave the door open after the function is triggered?
If the door is open, then it opens again upon a secondary press of "E".
Could you please tell me how to add sound to the door in the same hinge script ?
Add: "public AudioSource hingeAudio" and on void OnTriggerStay add: "audioPuerta.Play();" that would work
the problem is when you click open door the door animation will start
hey! idk if you'll see this, but is there a way to make the keys for specific doors?
When I click the key the door automatically opens😭😭 idk how to fix it
You're a lifesaver thanks man
Thanks for the help!
Hey, for some reason when I press E it always opens no matter what. I tried turning the collides and triggers off and on but it still doesn’t work right
im getting the same error. pls help
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PickKey : MonoBehaviour
{
public Component doorcolliderhere;
void OnTriggerStay()
{
if (Input.GetKey(KeyCode.E))
{
doorcolliderhere.GetComponent().enabled = true;
}
}
}
tytyty
thanks man
thnks a lot man appreciate ur work thnxxx still working...but at last in which u add input e key i didnt do that and still my door opens
bro i am using same method for smthing else and whenever i start it auto matically loops the animation
Play Automatically should be turned off in the Animation component of the Hinge object
you are awesome
nice
Aweeeeesome. Thanks man.
You're welcome!
hi video very nice how to close the door can you send the script code?
buyur kardeşim
public class doorlockopen : MonoBehaviour
{
kendin yaz brom... hehexd
}
@@yagizdincel Sjsjjdj
Thanks for the video but ive copied everything you did but i can pick up the key from anywhere in the scene. Anyone know how to fix ?
Couple of things might be miss-placed, the size of the box collider on both sides of the colliders(player/key), you might want to specify the collider , the on trigger method involves the collider of the game object where the script is and the "other" thats the target collider, you can place an if to specify the "other" collider with the key.
why the doors animate 1 time Can you tell me howw because me soo confused
hey idk if you still looking for the answer but you gotta make a door close animation
Its amazing but I cant add the animation Hingehere bit
Whats the problem exactly, it works for me
It works, thanks
Very uselful
you are the best
the music feels like ohio
sh1t 1 day of work and nothing happened