Collision Detection in my Procedural Animation State Machine

Sdílet
Vložit
  • čas přidán 1. 07. 2024
  • Collision detection is crucial for my procedural animations, and in this video, I’ll show you exactly how I implemented it in my state machine.
    We'll cover creating a custom Environment Detection Collider which programmatically adjusts its size and position. And then use trigger events to detect and interact with objects in your game environment. We'll cover essential techniques to calculate the closest points on colliders and update inverse kinematics (IK) targets for realistic animations.
    Join me as we break down the steps to make your procedural animations more immersive and responsive. This tutorial builds on our previous episodes, so if you haven't seen those, be sure to check them out for a complete understanding of our state machine setup.
    SUPPORT THE CHANNEL AND GET EXCLUSIVE PERKS:
    💛 / iheartgamedev (Project Files Available)
    ❤️ czcams.com/users/iHeartGameDev...
    WANT MORE?
    Interested in learning more about animating characters in Unity? Check out my growing series of tutorials:
    ✅ • Programming For Produc...
    ✦ Like the vid? Please consider Subscribing!
    bit.ly/2YdIb6j
    ✦ Missed out on the last episode?
    • How to Move Characters...
    SOCIAL:
    ✦ Discord
    / discord
    ✦ Twitter
    / iheartgamedev
    ►TIMESTAMPS:
    Intro: 0:00
    Collider for Detecting The Environment: 0:25
    How does the Detection Work: 3:45
    Get Closest Point On Collider: 4:35
    Environment Interaction Shared Methods: 5:57
    Animating the Correct Side: 7:20
    Testing SetCurrentSide: 10:33
    Being selective with Layers: 11:15
    Testing Interactable Layers: 12:54
    IK Target Placement: 13:20
    Weights: 18:00
    #unity3d #designpatterns #gamedev

Komentáře • 29

  • @iHeartGameDev
    @iHeartGameDev  Před měsícem +15

    Over a year into it and the procedural animation series continues! I know it has been a long wait for this next entry, but I hope it was worth the wait! I should have a new video (unrelated to the procedural animation series) soon that I'm very excited about!

  • @slsno3333
    @slsno3333 Před měsícem +1

    TBH have watched most videos 2x (some parts many times just to keep track between classes and scripts, where to put what.
    No idea where to begin, integrating a decent non rigbod character controller.
    Just that first moment once the left arm finaly did its own thing!
    Thank u so much for helping me learn.

    • @iHeartGameDev
      @iHeartGameDev  Před 29 dny

      Hey I'm really happy to hear that you've been able to get through it! :) Thank you for following along and the support!

  • @kremuwczan
    @kremuwczan Před měsícem +3

    In order to isTrigger in box collider to work, either the player or the object that is triggering has to have rigid body attached to it right? from my testing it seems to be the case, so if someone is having issue that his box collider is not working make sure that either the player (if not using character controller) or the object has rigid body

  • @rbjimmy7096
    @rbjimmy7096 Před měsícem

    Great video! I really like your presentation style, it helps me understand hard concepts in a way no other creator could. Do you ever plan on doing videos about saving/loading data?

  • @ChristinaCreatesGames
    @ChristinaCreatesGames Před měsícem +1

    Very cool system 💛 Will have to take some time on the weekend to go through this, looking forward to it :D!

    • @iHeartGameDev
      @iHeartGameDev  Před měsícem

      Thank you Christina! :) Can't wait to get through these last few episodes

  • @Hoptronics
    @Hoptronics Před měsícem +3

    Can't wait.. :)

  • @AlexBlackfrost
    @AlexBlackfrost Před měsícem +1

    it's all coming together 👌

  • @GameDev-re6rr
    @GameDev-re6rr Před měsícem +1

    Great explanation buddy. keep doing this good work and education new game devs

    • @iHeartGameDev
      @iHeartGameDev  Před měsícem

      Thank you for the kindness! More to come!!

  • @sugarsores6521
    @sugarsores6521 Před měsícem

    Damn good series fr

  • @framespaceproductions
    @framespaceproductions Před měsícem

    wow that's awesome , thanks buddy .
    can we do the same thin with doors , like how characters in rdr2 or gtav do ?

  • @sohjingkaisean3934
    @sohjingkaisean3934 Před měsícem +1

    Bro cook. This is crazy good

  • @aritrachatterjee4257
    @aritrachatterjee4257 Před 11 dny +1

    Anybody facing a problem where, the box collider is detecting only the player and nothing else?

  • @NOTAHEK
    @NOTAHEK Před měsícem +1

    I love your videos ❤ can you make a video on what DLL files does in unity 🥺.

    • @iHeartGameDev
      @iHeartGameDev  Před měsícem

      Hi! Thank you 🙏 What is DLL?

    • @NOTAHEK
      @NOTAHEK Před měsícem

      @@iHeartGameDev I am asking to you 😀

    • @NOTAHEK
      @NOTAHEK Před měsícem

      @@iHeartGameDev also you should have used physics.overlapping collider this will give you all the list of objects not just one 😊

  • @SantaGamerYoutube
    @SantaGamerYoutube Před měsícem +1

    How about using non-allocating collision detection? I've pretty much replace all collision detection with those.

    • @iHeartGameDev
      @iHeartGameDev  Před měsícem

      Hi! What do you mean by that?

    • @SantaGamerYoutube
      @SantaGamerYoutube Před měsícem

      Using Physics.OverlapBoxNonAlloc, .OverlapSphereNonAlloc or .RaycastNonAlloc.
      It doesn't generate new arrays so it doesn't create new garbage.
      You'll then just need to create OnEnter and OnExit methods yourself if needed.

    • @hldfgjsjbd
      @hldfgjsjbd Před měsícem

      Thought about same thing

  • @lawrence9713
    @lawrence9713 Před 29 dny

    It is kind of off topic, but maybe someone knows a solution to it or can help me out. I want to create just the raw animation data in order to be able that every character in the scene could enter into this animation.
    For example, I have a spot on the map where a crime is happening, one npc is stabbing another npc. The two first npcs of many random npcs entering this area should take the spot of the criminal and the victim. So that every time you start the level these two npcs interacting with each other can always be different npcs.
    I was thinking of creating the animation in Blender, but not attaching fixed characters to it but Unity assigning them by whoever enters the trigger area first. Is that even possible? Isn't it like some kind of realtime cutscene, where your custom created character can show up in a pre made cutscene?