Dealing damage to AI using hitboxes, ragdolls, and healthbars in Unity [AI #02]

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

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

  • @ravipandya198
    @ravipandya198 4 года назад +28

    Only channel that's focus on real gaming thing .

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

      yep

    • @anttiv7109
      @anttiv7109 4 месяца назад

      It's also refreshing to hear "we can just go with the basic settings and tune these later"
      Many tutorials just focus on fine-tuning everything right away and makes you forget the bigger picture.

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

    Legendary as always man, its like getting a top tier AAA asset for free.

  • @ryan5882
    @ryan5882 4 года назад +13

    Honestly the best tutorials I have watched man keep it up you're going to be big soon I can tell.

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

    Dude, you are killing it! Great tutorial, keep it up please!

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

      Thank you Ted!

    • @FelineRaptor-gv4te
      @FelineRaptor-gv4te 3 года назад

      @@TheKiwiCoder But you could have just used the default unity slider for making the health bar by right clicking on the canvas > UI > Slider. done. then you can adjust its value via script by using slider.value

  • @iadeb-lj1ip
    @iadeb-lj1ip 4 года назад +4

    this channel is PURE GOLD
    Everything is well explained, and these cut-less records makes each step easier to understand and follow
    please keep making these amazing tutorials, i lov u

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

    Hey mate wanted to let you know that these are among the best Unity tutorials I have ever seen. Thank you so much for that ace content!

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

    All I gotta say is you're awesome man, I love your tutorials!

  • @raingamedev702
    @raingamedev702 4 года назад +3

    Thank you! this is the best tutorial series I've ever seen on this topic, in-depth, concise and very cool :). And I was just doing a research recently speculating whether I should buy another character controller asset or create my own (I already have a commercial controller but could not extend it to my needs). I hope you will continue. Thanks again! P.S. adding melee features will make videos even more interesting ;)

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

    You absolute legend! this is the only tutorial that worked for me, thanks!

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

    I am coming back to your videos to ameliorate my project and it always works!

  • @r1pfake521
    @r1pfake521 3 года назад +6

    15:40 Im not sure if you are aware of this but the material property will create a new material instance every time, so this code causes a memory leak. The sharedMaterial property returns the "original" material, but this would change the color of every enemy, so the solution here is to either write a custom shader or use MaterialPropertyBlock to change the color per Renderer

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

    Hi, my ragdoll isnt realy working. Everything flyes around after I created the ragdoll. Just the spine is chasing me. After a minute a tube and not my ai was chasing me

  • @witnnileUnity
    @witnnileUnity 2 месяца назад

    hello dude, ım living same problem in 3.36 and ı set kinematic to bodyparts. Not same but colliders already moving to far away slowly from the their centers. What can ı do?

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

    I really enjoyed this gameplay. Saved to favorites!

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

    This is great, exactly what I needed for a project I'm working on. Thanks for sharing😃

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

    Sweet. Looking forward to try it myself.

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

    Thank you for your tutorial. For the hitbox effect (16:37), does the material matter?
    The object which I applied the skinnedMeshRenderer like how you did just stays in white color.
    So I deleted the skinnedMeshRender Component and replaced all the "skinnedMeshRenderer" in the script with "MeshRenderer" instead. The problem seems to be solved then.
    I was using a primitive object to test the result.

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

    Is good like always being watching your videos 😎

  • @programmer2AG
    @programmer2AG 3 месяца назад

    15:41 hole up wait a minute, how does that automatically activate the emission and increase the intensity you only assigned the color right? how does that work?

  • @NewbNinjas
    @NewbNinjas 2 года назад +2

    How do you get it to flash if you're already using emissions for something else? The model I'm using has a texture and uses URP / Lit and the emission is already being used on the parent object which handles the glow of the eyes.

  • @reckless8404
    @reckless8404 2 года назад +2

    You forgot to disable the ai following you when dead, I implemented GetComponent().enabled = false; in Die(); function in "Health" script to fix this issue.

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

    I just spent more (and frustrating) time than I'd like to admit troubleshooting why my guy would break upon shooting and it was because I had 9:52 outside of the if statement. As soon as I moved it to the correct place, everything worked without issue.

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

    Thanks for the hit effect, it´s was so easy to implement

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

    Can you somehow make a health bar UI that is fixed let's say to the bottom of the screen without the need of a target part in the code/ui?

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

    Very helpful, thank you.

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

    HELP, when I copy and paste the AIAgent and shoot the new AiAgent it the first AIAgent takes damage instead and when he is killed it gives me a no reference error

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

    Did he do a toutorial about when hes applying the force to a rigidbody in 7:57 as I rewatched older videos and cant seem to find it

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

    28:09 the bar is display above player, now i want the part player hides it display behind player in that case, how to do that?

  • @a.technology1446
    @a.technology1446 3 года назад

    I find ur tu very helpful, thank you ❤️

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

    is there anyway to do use the hitboxes with a sword edit : nvm if figured it out

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

    Hey Great Tutorial!!! , Can you please share the Code or make a tutorial for RaycastWeapon Script?

  • @thebulletkin8393
    @thebulletkin8393 10 месяцев назад

    Was the rest of this made by you also? We seem to be jumping into an existing project but I'm keen to see how that was put together

  • @lordalfred
    @lordalfred 3 месяца назад

    I have a problem when I use aply force on a ragdoll it moves out of enemy transform and when I come close to the ragdoll it doesn't render it. Any advices?

    • @TheKiwiCoder
      @TheKiwiCoder  3 месяца назад

      It’s getting culled from the view frustrum based on the renderer bounds

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

    I'm having trouble with cinemachine's camera and the UI health bar. Seems that the worldToScreenPoint returns different when it's a normal camera (which is working fine) but can't get working with the cinemachine's. It just keep moving around and don't keep in the targets position. Does it happened to somebody? And how could I fix it? Thank you

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

    Awesome bro, AAAAAAAA+ GAME TUTORIAL

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

    Awesome tutorial, but I've got a little problem. at 9:49 when you copy and change the rigidbodies to hitboxes, because I followed Brackeys gun tutorial, I am not sure what to change. Any ideas?

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

    Do you have a clever solution of handling area damage (sphere check) with such a hitbox system?

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

    if my rig dsnt has elbows ands right left hips what i do? i use mixamo rig

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

    Hiya, Ive got to the final part now thank you so much Kiwi Coder, my characters only appear the white now tho like the materials not working now, any ideas? :)

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

    Hey, great content! I have learned a lot from watching your videos. I have a question though, I'm now trying nav mesh (Unity 2022, I assume the nav mesh is an updated version here) and can't apply knockback on rigidbodies. I mean they cancel each other I guess, conventional "enemyRigidbody.AddForce(knockbackDirection * power, ForceMode.Impulse);" method doesn't work. Do you know how I can apply a knockback/ish-like effect on enemies while using nav mesh?
    Thank you for your time in advance, have a great day!

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

    Hello Sir.. I am facing a problem when I import a character from blender to unity... When I attache Animation Rigging setup... Mesh Start floating in air and if I attach weapon or something It shows error of saying weapon Slot transform is not found in human description.... What's the issue

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

    When I apply the Universal Render Pipeline/lit shader to my material everything using that material turns pink, I have tried the common fix of upgrading my project materials but that still didnt work, if I change my materials back to the standard shader everything goes back to normal but I need to use UPR in order to add the emission, any suggestions?

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

      if you already done "update materials to urp pipeline" in Edit -> Render pipeleine -> etc... make sure you have in "Project settings -> graphics -> scriptable render [...]", one selected or if it was one there, you still have'it there... Some times when you import packages, that config may be removed or changed by external sources.

  • @GuyWatchingTutorials
    @GuyWatchingTutorials 7 месяцев назад

    Since you made hitboxes,how would you do a different headshot damage for instance? Thanks in advance.

  • @王一次缘结一次绳
    @王一次缘结一次绳 Год назад

    Can the gun aim to sky or ground? how?Rig is too hard

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

    the doll goes flying 😆😆

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

    You can instead getcomponent recttransform use var rt = transform as RectTransform

  • @maitrykotak3703
    @maitrykotak3703 10 месяцев назад

    please give a link if u had worked on complete third person shooter game,,,as i am new to this...n this channel i shelping me a lot

  • @kyoseoul
    @kyoseoul 10 месяцев назад

    17:14 Enemy accends to heaven but comes back

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

    Hello good first congratulations for the tutorials the best that I found, I have a question would it be useful for the asset Pro Military? Thanks.

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

      This series has mostly been geared towards TPS rather than FPS. But there is a lot of overlap for sure.

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

      @@TheKiwiCoder Thanks, but could it be useful? is that there are no tutorials to implement an AI with Pro Military and it is a pity, it would be too much to ask you if you could do a tutorial on how to implement an AI for Pro Military? I really liked your AI.

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

    I'm using a Trigger instead of a raycast since I'm using a melee system. how could I make this work with my melee system?

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

      Hey you could try swapping the trigger for a physics overlap check each frame on the melee instead

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

    KiwiCoder wanted to know if the next video you were going to upload from the behavior tree for basic AI is in your uploaded patreon or you haven't finished it yet, because if you're uploading your content there, right now I'm taking out my wallet, I really learn a lot with you bro, your content is addictive for people who love programming

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

    8:52 What about getting the root gameobject with the health component on it?

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

      That would work too! I thought it was easier to pass the health to the hit box as they can be at different levels in the hierarchy.

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

    Love from India

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

    Added ragdoll to my enemy, now he moves as fast as Sonic the hedgehog. Had to delete him entirely and reconfigure him again. fml, I should've created a copy to test first.

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

    I have a question, does this work with non raycast?

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

    Kiwi please tell how tp add mobile inputs?

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

    thankyou so much my character is also going on top of enemy head, after that i set , is kinematic true, now it is working.

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

    Hi, my model's hitboxes are only sometimes registering Raycast hits. What can it be? I've tried both continuous and discrete collision detection on the RBs, but it's the same.
    How would you go about tracing this? So far I've tried exaggerated impact effects, but... it's not helping - it simply doesn't register hits sometimes, for some mysterious reason.

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

      Hi I am also facing the same issue. I use raycast from center of the screen and it just passes the colliders. If u have found any solution pls share 🙏

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

    This strafe walking anims seems like different from the main tps shotter videos. How it did, did you use another anims? Can you share anims with us?

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

      I made these in blender, both the Unity and project files are available via Patreon: patreon.com/thekiwicoder

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

    How do I make the UI not appear when the agent is behind a wall?

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

      Keep some visibility information on the Ai if it can see the player (or vice Versa) by raycasting periodically or some other means. The use this to hide/show the ui

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

    KiwiCoder when you release your next video of the AI Enemies, your absence of content is felt in the community, more than someone as talented as you bro uu, I hope your return soon bro.

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

    Join your patreon today, thanks for awesome tutorials, but please zoom the code window for my old eyes a little bit.

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

      Thank you, much appreciated! 🙏 I will make sure to zoom in future vids 🔍

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

    can you please make a tutorial on how I can make a ragdoll enemy which follow player

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

      Cool topic, thanks for the suggestion :) try searching for powered rag dolls in the meantime.

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

      @@TheKiwiCoder oooh thank you soo much!!

  • @RichardCheese-go2rh
    @RichardCheese-go2rh Год назад

    How do I get the Raycast Weapon script or what is that?

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

      Hey, it’s covered in the previous TPS series, Episode #05

  • @3bomb
    @3bomb 2 года назад

    I love you.

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

    10:41 just saving my time :)

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

    Does this work with projectile shooting

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

      Should do yes! The principle is the same. Instead of raycast though listen for OnCollision/Trigger Enter events.

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

    future me. You're at 13:00

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

    dawload progect plesssssssse

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

    Tip for similar beginners like me, but if there is a easy way please inform me.
    if your enemy have more than one materials on it then use this.
    private void Update()
    {
    blinkTimer -= Time.deltaTime;
    float lerp = Mathf.Clamp01(blinkTimer / blinkDuration);
    float intensity = (lerp * blinkIntensity) + 1.0f;
    // i have two material so i used it two times
    // materials[indexofmaterial]
    skinnedMeshRenderer.materials[0].color = Color.white * intensity;
    skinnedMeshRenderer.materials[1].color = Color.white * intensity;
    }