Unity 3D: Animate & Trigger A Door

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 74

  • @blakerobertson9989
    @blakerobertson9989 4 года назад +18

    Omg i literally searched all of RUclips and all of the totorials were like 500 lines of code. Thank you for making this

  • @striverfor7628
    @striverfor7628 2 года назад +7

    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

  • @vikirthanarul2193
    @vikirthanarul2193 3 года назад +5

    This is such a perfect tutorial. Not so fast. Not too slow. Perfect pace to follow. Thanks a ton!

  • @darkmonarchy2206
    @darkmonarchy2206 4 года назад +4

    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

  • @jonshidler2891
    @jonshidler2891 4 года назад +1

    Been trying to find a good tutorial for doors and couldn't. Thank you for making this tutorial very helpful got my level working!

  • @xAkinaNozomi
    @xAkinaNozomi 3 года назад +2

    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.

  • @julianlim1742
    @julianlim1742 3 года назад +1

    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.

  • @suspense_comix3237
    @suspense_comix3237 Год назад +1

    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.

  • @BugBench
    @BugBench 3 года назад

    I've been searching for days! i finally did exactly what i was aiming for! thank you for the great tutorial

  • @Bill-us8nn
    @Bill-us8nn 4 года назад +1

    Great tutorial, thanks. Hope the channel grows as it deserves to...

  • @chrisa7583
    @chrisa7583 4 года назад +6

    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
      @MoreNimrod 4 года назад +1

      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
      @xAkinaNozomi 3 года назад

      @@MoreNimrod Just had the same problem and this fixed it, thanks :)!

  • @peopledevelopmenthrdcikara2495
    @peopledevelopmenthrdcikara2495 2 года назад

    Thank you Cor Games for this tutorial, its very help

  • @thehijacker6340
    @thehijacker6340 2 года назад +1

    I am having an issue with Animator is not playing an AnimatorController. Does anyone know how to fix this issue?

  • @kozmobotgames
    @kozmobotgames Год назад

    Great video! I have also made the unlockable door in Unity and my scene is pretty much low poly 😀

  • @erikm9768
    @erikm9768 11 месяцев назад

    Perfect, didnt know this was possible! thought you had to do it in Blender and import an fbx

  • @pogchamp1081
    @pogchamp1081 3 года назад

    Such a great toturial! I was lloking up so many videos but none of them worked.

  • @TheShoden
    @TheShoden 5 лет назад +1

    Very cool! Thank you for posting this tutorial.

  • @eyelight1191
    @eyelight1191 2 года назад

    Thank you so much, this was allot of help to me, keep up 🍀

  • @ZyonOfficial
    @ZyonOfficial 3 года назад

    I have a problem where i get pushed by an invisble opening and closing door but the actual visible object isnt moving at all?

  • @projectRaMan
    @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?

  • @aw6971
    @aw6971 4 года назад +2

    Finally!! Thank You!!!!! Subscribed......

  • @burgies1636
    @burgies1636 4 года назад

    Easy to fallow tutorial. Keep up the good work!

  • @But_WhatIf
    @But_WhatIf 3 года назад +1

    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.

  • @fredqq2003
    @fredqq2003 2 года назад

    I found out that our player needed be to added a character controller component in order to trigger the door. Is that true?

  • @bromine35
    @bromine35 3 года назад

    My collider is being animated up and down since it is a child of the door. How can I prevent this?

  • @Albert-Freeman
    @Albert-Freeman 3 года назад

    Is there any way to make the trigger just not move? So I don't need to change its size...

  • @etheriondesigns
    @etheriondesigns 2 года назад

    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?

  • @Sharkz-iz6yf
    @Sharkz-iz6yf 4 года назад +4

    14:00 I’m gonna go swim now :)

  • @Radek_M.
    @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?

  • @roshan3554
    @roshan3554 Год назад

    Great vedio a request for make a vedio how to open when interact a door by clicking "e" and use keycode to open

  • @leasboul
    @leasboul 2 года назад

    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

  • @mariusst09
    @mariusst09 Год назад

    Thenks bro ❤

  • @zoomonnick6517
    @zoomonnick6517 3 года назад

    you are a king good sir

  • @Btomaek
    @Btomaek 3 года назад +1

    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

  • @lovecraftiancat6646
    @lovecraftiancat6646 3 года назад

    Thank you so much this really helped a lot!

  • @divyasrivatava134
    @divyasrivatava134 3 года назад

    Use on trigger stay for opening and closing door

  • @pizzacat6324
    @pizzacat6324 4 года назад +1

    For some reason, when i start the game, my door teleports to 0,0,0. can i have help

    • @drewpriebe5372
      @drewpriebe5372 4 года назад

      Did you ever figure this out? In scene view everything is perfect, but when I start the game my door also teleports

    • @ImInfenix
      @ImInfenix 4 года назад

      @@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
      @appelbanaan2633 3 года назад

      @@ImInfenix oh thx bc my doors are disapearing to thx!!

    • @appelbanaan2633
      @appelbanaan2633 3 года назад

      but it still didnt work

  • @_ciraz_
    @_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
      @appelbanaan2633 3 года назад

      i need help tooo, do you know how to fix it now?

    • @_ciraz_
      @_ciraz_ 3 года назад

      @@appelbanaan2633 no, I am sorry

  • @monke5507
    @monke5507 3 года назад

    thanks man your best keep going

  • @BomberTVOriginal
    @BomberTVOriginal 3 года назад

    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
      @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
      @ramonalders8205 3 года назад

      @@BomberTVOriginal how did u fix it. i am facing the same problem

    • @BomberTVOriginal
      @BomberTVOriginal 3 года назад +1

      @@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
      @ramonalders8205 3 года назад

      @@BomberTVOriginal thank you verry much. I fixed my issue as well :)

  • @kerazza3574
    @kerazza3574 4 года назад +1

    not working: "The referenced scripts on this behaviour "Game obcject "DoorTrigger") Is mising

    • @CorGames
      @CorGames  4 года назад

      Have checked is trigger?

  • @Username-it8co
    @Username-it8co 4 года назад

    What if you want to have more than 1 door?

    • @CorGames
      @CorGames  4 года назад

      Duplicate the while thing and rename where applicable

    • @kidnappednapkin
      @kidnappednapkin 4 года назад

      Could you do a short video on that problem

  • @gh4zera
    @gh4zera 4 года назад

    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
      @thommarch6409 3 года назад

      Try add the doorTrigger to the door Game object not to the Parent object

  • @D3ADM0N5T3RC4T
    @D3ADM0N5T3RC4T 2 года назад

    thank you so much! 😄

  • @christopherfarrell-artist3557
    @christopherfarrell-artist3557 4 года назад +1

    Thank you!!!

  • @adriangg9018
    @adriangg9018 3 года назад

    Thanks!

  • @ibrahimkeskin1723
    @ibrahimkeskin1723 3 года назад

    So Thanks :)

  • @igoraction
    @igoraction 4 года назад

    Greeaaaaaaaatttttt!!!!!

  • @kevo332
    @kevo332 3 года назад

    TYSM

  • @direct3d34
    @direct3d34 4 года назад

    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
      @rickym7380 4 года назад

      to add a sound just put a underneath "audioSource.Play();" "_doorAnim.SetBool("IsOpening", false);" and "_doorAnim.SetBool("IsOpening", true);"

  • @Morrisonfam2020
    @Morrisonfam2020 3 года назад

    wow cool video 5 STARS

  • @TajuSingh
    @TajuSingh 4 года назад

    my visual dose does not show the animator

  • @CHTOUROU_BECHIR
    @CHTOUROU_BECHIR 2 года назад

    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
      @chknmcnuggers4577 2 года назад

      how

    • @CHTOUROU_BECHIR
      @CHTOUROU_BECHIR 2 года назад

      @@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 😋