Using states and transitions to animate a trigger and door when a FPS Controller comes in close proximity.
Жүктеу.....
Пікірлер: 74
@blakerobertson99893 жыл бұрын
Omg i literally searched all of KZread and all of the totorials were like 500 lines of code. Thank you for making this
@vikirthanarul21932 жыл бұрын
This is such a perfect tutorial. Not so fast. Not too slow. Perfect pace to follow. Thanks a ton!
@julianlim17423 жыл бұрын
very nice tutorial, was patient in explaining each step and how to tackle potential issues that may come up in the making of the animation. Very helpful especially since its my 1st time using unity for my project. Like button SMASHED.
@darkmonarchy22064 жыл бұрын
nice to find a tutorial a total amateur like me can digest, so many unity content creators struggle with the "this is all new to me " concept, many thanks
@jonshidler28914 жыл бұрын
Been trying to find a good tutorial for doors and couldn't. Thank you for making this tutorial very helpful got my level working!
@MarcyMarsh3 жыл бұрын
I've been searching for days! i finally did exactly what i was aiming for! thank you for the great tutorial
@striverfor7628 Жыл бұрын
0:44 Animation 13:36 Script Coding 13:59 16:11 OnTriggerEnter 18:18 Closing the door Coding 18:52 OnTriggerExit 19:56 Fixing a problem. Enlarge the trigger
@Bill-us8nn4 жыл бұрын
Great tutorial, thanks. Hope the channel grows as it deserves to...
@TheShoden4 жыл бұрын
Very cool! Thank you for posting this tutorial.
@peopledevelopmenthrdcikara24952 жыл бұрын
Thank you Cor Games for this tutorial, its very help
@burgies16364 жыл бұрын
Easy to fallow tutorial. Keep up the good work!
@eyelight1191 Жыл бұрын
Thank you so much, this was allot of help to me, keep up 🍀
@aw69713 жыл бұрын
Finally!! Thank You!!!!! Subscribed......
@lovecraftiancat66463 жыл бұрын
Thank you so much this really helped a lot!
@suspense_comix323711 ай бұрын
When I was younger and just started Unity, I only knew how to use Collision to detect stuff, like, if the player was on the ground or something. However, when it came for me to add doors to my game I struggled because I didn't know how raycasts work. So I decided to use the good old colliders to try to solve my problem. I set up a capsule collider which extended around the torso of my player, shaped like a pill, and used Triggers and stuff to try to open doors. Did it work? Kind of. Was it good? Absolutely not. You could literally grab ANYTHING out of closed doors, more specifically through wardrobes and closets and cupboards.
@pogchamp10812 жыл бұрын
Such a great toturial! I was lloking up so many videos but none of them worked.
@xAkinaNozomi3 жыл бұрын
Thank you so so much for this tutorial, I was so desperate, because tackling all that code for the first time can be so intimidating without the proper explanation. You literally just saved my day, thank you.
@ramonalders8205
3 жыл бұрын
i am lookin for the same awnser
@monke55072 жыл бұрын
thanks man your best keep going
@zoomonnick65172 жыл бұрын
you are a king good sir
@kozmobotgames8 ай бұрын
Great video! I have also made the unlockable door in Unity and my scene is pretty much low poly 😀
@etheriondesigns2 жыл бұрын
Great tutorial! However, I am creating a door prefab. And since the prefab has multiple instances in the level, this code seems to only work for one of them. The rest are doing nothing! Do you have a method to make sure all instances of the door prefab also animate?
@divyasrivatava1343 жыл бұрын
Use on trigger stay for opening and closing door
@erikm97686 ай бұрын
Perfect, didnt know this was possible! thought you had to do it in Blender and import an fbx
@D3ADM0N5T3RC4T Жыл бұрын
thank you so much! 😄
@Albert-Freeman3 жыл бұрын
Is there any way to make the trigger just not move? So I don't need to change its size...
@ZyonOfficial2 жыл бұрын
I have a problem where i get pushed by an invisble opening and closing door but the actual visible object isnt moving at all?
@But_WhatIf3 жыл бұрын
you saved my ass, had to get open doors done for a Project and could not remember for the life of me how to script it.
@mariusst09 Жыл бұрын
Thenks bro ❤
@bromine353 жыл бұрын
My collider is being animated up and down since it is a child of the door. How can I prevent this?
@christopherfarrell-artist35573 жыл бұрын
Thank you!!!
@projectRaMan Жыл бұрын
Is there a better way of fixing the trigger problem that isn't making it huge? What if you have a floor above and below that floor and something enters the trigger?
@leasboul2 жыл бұрын
Extremelly difficult to complete! What university degree you need first in order to understand Unity? Also where can I find THIS door to import it as an asset? Because I tried with any other and doesn't work
@Radek_M.2 жыл бұрын
When you double click the "chest-menu" button you have yo also double click the background button to close it. Anyone has figured out how to fix it?
@fredqq2003 Жыл бұрын
I found out that our player needed be to added a character controller component in order to trigger the door. Is that true?
@adriangg90183 жыл бұрын
Thanks!
@thehijacker63402 жыл бұрын
I am having an issue with Animator is not playing an AnimatorController. Does anyone know how to fix this issue?
@roshan3554 Жыл бұрын
Great vedio a request for make a vedio how to open when interact a door by clicking "e" and use keycode to open
@ibrahimkeskin17233 жыл бұрын
So Thanks :)
@igoraction99783 жыл бұрын
Greeaaaaaaaatttttt!!!!!
@chrisa75833 жыл бұрын
i have 2 animations that have a transition into eachother. When i modify the bool, its playing the open animation then directly closes. any help?
@MoreNimrod
3 жыл бұрын
In your assets, click on the animation ciips. If you have an animation for opening the door or closing the door, uncheck 'Loop Time'. That means it'll only play once now after the bool is modified; otherwise it wants to loop the animation and it looks off.
@xAkinaNozomi
3 жыл бұрын
@@MoreNimrod Just had the same problem and this fixed it, thanks :)!
@kevo3323 жыл бұрын
TYSM
@gh4zera4 жыл бұрын
hello, i need help. I have this error : There is no 'Animator' attached to the "Trigger" game object, but a script is trying to access it. You probably need to add a Animator to the game object "Trigger". Or your script needs to check if the component is attached before using it. Can you help me ? Thank in advance.
@thommarch6409
2 жыл бұрын
Try add the doorTrigger to the door Game object not to the Parent object
@Sharkz-iz6yf4 жыл бұрын
14:00 I’m gonna go swim now :)
@_ciraz_3 жыл бұрын
Help please... My door is always opened but it doesn't want to close.. I have "Loop Time" deactivated on the Opening and Closing animation. But the On Trigger Exit somehow doesn't work and it's not because of the coding, since I don't get any error in Unity.
@appelbanaan2633
2 жыл бұрын
i need help tooo, do you know how to fix it now?
@_ciraz_
2 жыл бұрын
@@appelbanaan2633 no, I am sorry
@BomberTVOriginal3 жыл бұрын
So my door opens and closes, but for some reason my character doesn't go through the door. Any ideas as to what could be the cause or what to look at?
@BomberTVOriginal
3 жыл бұрын
Nevermind. I didn't realize that the unity Character Controller has what seems to be some kind of built in collider. Fixed.
@ramonalders8205
3 жыл бұрын
@@BomberTVOriginal how did u fix it. i am facing the same problem
@BomberTVOriginal
3 жыл бұрын
@@ramonalders8205 I havent messed with it in a while so sorry if I'm lacking on details. Your character has an invisible hitbox. One of the issues could be that the hit box is just too big for the for. If you make it small, you should be able to go through. That was my issue.
@ramonalders8205
3 жыл бұрын
@@BomberTVOriginal thank you verry much. I fixed my issue as well :)
@kerazza35744 жыл бұрын
not working: "The referenced scripts on this behaviour "Game obcject "DoorTrigger") Is mising
@CorGames
4 жыл бұрын
Have checked is trigger?
@pizzacat63243 жыл бұрын
For some reason, when i start the game, my door teleports to 0,0,0. can i have help
@drewpriebe5372
3 жыл бұрын
Did you ever figure this out? In scene view everything is perfect, but when I start the game my door also teleports
@ImInfenix
3 жыл бұрын
@@drewpriebe5372 I think this is normal. Just place an empty gameobject in the scene where your door is supposed to be and place your door as a child. Then it will still go at 0,0,0, but the 0,0,0 will correspond to the parent's transform. Your animation is a local animation, you are animating that specific door, so you need to do it. Otherwise, the parent object is the scene root and so your object teleports to it at runtime.
@appelbanaan2633
2 жыл бұрын
@@ImInfenix oh thx bc my doors are disapearing to thx!!
@appelbanaan2633
2 жыл бұрын
but it still didnt work
@Username-it8co3 жыл бұрын
What if you want to have more than 1 door?
@CorGames
3 жыл бұрын
Duplicate the while thing and rename where applicable
@kidnappednapkin
3 жыл бұрын
Could you do a short video on that problem
@Morrisonfam20203 жыл бұрын
wow cool video 5 STARS
@direct3d344 жыл бұрын
Thanks for a very nice tutorial :-) Can you make a tutorial that shows: Player Enters Collider- A text message comes up: ("Press E To Activate Door") and when E is pressed the door opens :-) This should only be possible inside the collider And add sound to the door opening and another sound to the door closing :-)
@rickym7380
3 жыл бұрын
to add a sound just put a underneath "audioSource.Play();" "_doorAnim.SetBool("IsOpening", false);" and "_doorAnim.SetBool("IsOpening", true);"
@TajuSingh3 жыл бұрын
my visual dose does not show the animator
@hugofekar8795
3 жыл бұрын
i have the same problem
@MrReallefauve2 жыл бұрын
Seriously?? you should have detach the trigger from the door so that it doesn't get animated with it, it's a very basic solution and it might teach your subscribers some very bad coding methods.😶
@chknmcnuggers4577
Жыл бұрын
how
@MrReallefauve
Жыл бұрын
@@chknmcnuggers4577 lol this was 9 months ago, i dont remember till i review the video, i can't now 'cause im in my office for Work 😋
@Btomaek2 жыл бұрын
it is 2021 and i couldn't get the script to run on 2020.3.17 i needed to get rid of "windowAnim = this.transform.parent.GetComponent();" and add "public" to the first line that was written then drag the object the scrip was in into that and everything now working this is a good tutorial just i'm not sure if it needs updating
Пікірлер: 74
Omg i literally searched all of KZread and all of the totorials were like 500 lines of code. Thank you for making this
This is such a perfect tutorial. Not so fast. Not too slow. Perfect pace to follow. Thanks a ton!
very nice tutorial, was patient in explaining each step and how to tackle potential issues that may come up in the making of the animation. Very helpful especially since its my 1st time using unity for my project. Like button SMASHED.
nice to find a tutorial a total amateur like me can digest, so many unity content creators struggle with the "this is all new to me " concept, many thanks
Been trying to find a good tutorial for doors and couldn't. Thank you for making this tutorial very helpful got my level working!
I've been searching for days! i finally did exactly what i was aiming for! thank you for the great tutorial
0:44 Animation 13:36 Script Coding 13:59 16:11 OnTriggerEnter 18:18 Closing the door Coding 18:52 OnTriggerExit 19:56 Fixing a problem. Enlarge the trigger
Great tutorial, thanks. Hope the channel grows as it deserves to...
Very cool! Thank you for posting this tutorial.
Thank you Cor Games for this tutorial, its very help
Easy to fallow tutorial. Keep up the good work!
Thank you so much, this was allot of help to me, keep up 🍀
Finally!! Thank You!!!!! Subscribed......
Thank you so much this really helped a lot!
When I was younger and just started Unity, I only knew how to use Collision to detect stuff, like, if the player was on the ground or something. However, when it came for me to add doors to my game I struggled because I didn't know how raycasts work. So I decided to use the good old colliders to try to solve my problem. I set up a capsule collider which extended around the torso of my player, shaped like a pill, and used Triggers and stuff to try to open doors. Did it work? Kind of. Was it good? Absolutely not. You could literally grab ANYTHING out of closed doors, more specifically through wardrobes and closets and cupboards.
Such a great toturial! I was lloking up so many videos but none of them worked.
Thank you so so much for this tutorial, I was so desperate, because tackling all that code for the first time can be so intimidating without the proper explanation. You literally just saved my day, thank you.
@ramonalders8205
3 жыл бұрын
i am lookin for the same awnser
thanks man your best keep going
you are a king good sir
Great video! I have also made the unlockable door in Unity and my scene is pretty much low poly 😀
Great tutorial! However, I am creating a door prefab. And since the prefab has multiple instances in the level, this code seems to only work for one of them. The rest are doing nothing! Do you have a method to make sure all instances of the door prefab also animate?
Use on trigger stay for opening and closing door
Perfect, didnt know this was possible! thought you had to do it in Blender and import an fbx
thank you so much! 😄
Is there any way to make the trigger just not move? So I don't need to change its size...
I have a problem where i get pushed by an invisble opening and closing door but the actual visible object isnt moving at all?
you saved my ass, had to get open doors done for a Project and could not remember for the life of me how to script it.
Thenks bro ❤
My collider is being animated up and down since it is a child of the door. How can I prevent this?
Thank you!!!
Is there a better way of fixing the trigger problem that isn't making it huge? What if you have a floor above and below that floor and something enters the trigger?
Extremelly difficult to complete! What university degree you need first in order to understand Unity? Also where can I find THIS door to import it as an asset? Because I tried with any other and doesn't work
When you double click the "chest-menu" button you have yo also double click the background button to close it. Anyone has figured out how to fix it?
I found out that our player needed be to added a character controller component in order to trigger the door. Is that true?
Thanks!
I am having an issue with Animator is not playing an AnimatorController. Does anyone know how to fix this issue?
Great vedio a request for make a vedio how to open when interact a door by clicking "e" and use keycode to open
So Thanks :)
Greeaaaaaaaatttttt!!!!!
i have 2 animations that have a transition into eachother. When i modify the bool, its playing the open animation then directly closes. any help?
@MoreNimrod
3 жыл бұрын
In your assets, click on the animation ciips. If you have an animation for opening the door or closing the door, uncheck 'Loop Time'. That means it'll only play once now after the bool is modified; otherwise it wants to loop the animation and it looks off.
@xAkinaNozomi
3 жыл бұрын
@@MoreNimrod Just had the same problem and this fixed it, thanks :)!
TYSM
hello, i need help. I have this error : There is no 'Animator' attached to the "Trigger" game object, but a script is trying to access it. You probably need to add a Animator to the game object "Trigger". Or your script needs to check if the component is attached before using it. Can you help me ? Thank in advance.
@thommarch6409
2 жыл бұрын
Try add the doorTrigger to the door Game object not to the Parent object
14:00 I’m gonna go swim now :)
Help please... My door is always opened but it doesn't want to close.. I have "Loop Time" deactivated on the Opening and Closing animation. But the On Trigger Exit somehow doesn't work and it's not because of the coding, since I don't get any error in Unity.
@appelbanaan2633
2 жыл бұрын
i need help tooo, do you know how to fix it now?
@_ciraz_
2 жыл бұрын
@@appelbanaan2633 no, I am sorry
So my door opens and closes, but for some reason my character doesn't go through the door. Any ideas as to what could be the cause or what to look at?
@BomberTVOriginal
3 жыл бұрын
Nevermind. I didn't realize that the unity Character Controller has what seems to be some kind of built in collider. Fixed.
@ramonalders8205
3 жыл бұрын
@@BomberTVOriginal how did u fix it. i am facing the same problem
@BomberTVOriginal
3 жыл бұрын
@@ramonalders8205 I havent messed with it in a while so sorry if I'm lacking on details. Your character has an invisible hitbox. One of the issues could be that the hit box is just too big for the for. If you make it small, you should be able to go through. That was my issue.
@ramonalders8205
3 жыл бұрын
@@BomberTVOriginal thank you verry much. I fixed my issue as well :)
not working: "The referenced scripts on this behaviour "Game obcject "DoorTrigger") Is mising
@CorGames
4 жыл бұрын
Have checked is trigger?
For some reason, when i start the game, my door teleports to 0,0,0. can i have help
@drewpriebe5372
3 жыл бұрын
Did you ever figure this out? In scene view everything is perfect, but when I start the game my door also teleports
@ImInfenix
3 жыл бұрын
@@drewpriebe5372 I think this is normal. Just place an empty gameobject in the scene where your door is supposed to be and place your door as a child. Then it will still go at 0,0,0, but the 0,0,0 will correspond to the parent's transform. Your animation is a local animation, you are animating that specific door, so you need to do it. Otherwise, the parent object is the scene root and so your object teleports to it at runtime.
@appelbanaan2633
2 жыл бұрын
@@ImInfenix oh thx bc my doors are disapearing to thx!!
@appelbanaan2633
2 жыл бұрын
but it still didnt work
What if you want to have more than 1 door?
@CorGames
3 жыл бұрын
Duplicate the while thing and rename where applicable
@kidnappednapkin
3 жыл бұрын
Could you do a short video on that problem
wow cool video 5 STARS
Thanks for a very nice tutorial :-) Can you make a tutorial that shows: Player Enters Collider- A text message comes up: ("Press E To Activate Door") and when E is pressed the door opens :-) This should only be possible inside the collider And add sound to the door opening and another sound to the door closing :-)
@rickym7380
3 жыл бұрын
to add a sound just put a underneath "audioSource.Play();" "_doorAnim.SetBool("IsOpening", false);" and "_doorAnim.SetBool("IsOpening", true);"
my visual dose does not show the animator
@hugofekar8795
3 жыл бұрын
i have the same problem
Seriously?? you should have detach the trigger from the door so that it doesn't get animated with it, it's a very basic solution and it might teach your subscribers some very bad coding methods.😶
@chknmcnuggers4577
Жыл бұрын
how
@MrReallefauve
Жыл бұрын
@@chknmcnuggers4577 lol this was 9 months ago, i dont remember till i review the video, i can't now 'cause im in my office for Work 😋
it is 2021 and i couldn't get the script to run on 2020.3.17 i needed to get rid of "windowAnim = this.transform.parent.GetComponent();" and add "public" to the first line that was written then drag the object the scrip was in into that and everything now working this is a good tutorial just i'm not sure if it needs updating