Patrolling AI in Unity with C#

Поділитися
Вставка
  • Опубліковано 20 сер 2024
  • A quick tutorial on making a patrolling AI in Unity.
    Music: Lasers by Amsterdam

КОМЕНТАРІ • 66

  • @DotCodeSO
    @DotCodeSO 28 днів тому

    Finally a video talking about waypoints! Thank you so much!

  • @yaqingcao4817
    @yaqingcao4817 2 роки тому +9

    This is the best patrol ai tutorial i found. Easy, simple, straightforward instructions. Very good for beginners and easy to do more based on this script.

  • @SassyPantsy
    @SassyPantsy Рік тому +2

    Perfect, Simple, straight forward, quick to set up. Perfect for prototyping.

  • @migueldc6845
    @migueldc6845 Рік тому +3

    Oh heck, your so calm and to the point. Thats really refreshing :) Thank you!!

  • @valeronbaleron836
    @valeronbaleron836 2 роки тому

    Oh my god man, my teaher tried to explain it to us during 30 minutes and anybody got when you made that in 5 minutes!
    You are soooo gooood, thanks god that found your video!
    Defenitely like!!!

  • @PeterSedesse
    @PeterSedesse 6 місяців тому

    You should always use a timer so that if your agent can't reach a waypoint it doesn't get stuck. If the timer gets to zero, you select a random waypoint as the new target.

  • @trailsnail
    @trailsnail Рік тому +1

    voice so smooth

  • @buriedbones-nh9xr
    @buriedbones-nh9xr 3 місяці тому

    Soothing voice
    thanks mate

  • @MoTivE-pw9hb
    @MoTivE-pw9hb Рік тому

    Amazing tutorial got my enemy characters walking in my scene!! now onto learning how to get them chasing and attacking 😉

  • @kiaora2601
    @kiaora2601 Рік тому

    Thank you a lot! straight to the point and very clear explanation!

  • @thebestcelep6358
    @thebestcelep6358 Рік тому

    Good and simple video I hope I learn other tips from you .

  • @carlabalos3884
    @carlabalos3884 2 роки тому

    Thanks! Easy to follow and short tutorial.

  • @lazyhsn
    @lazyhsn 2 роки тому

    Thank you man. It is very simple and easy solution.

  • @rudyramadhana4127
    @rudyramadhana4127 Рік тому

    thank you, it worked flawlessly!

  • @GLXY_SHADOW
    @GLXY_SHADOW Рік тому

    It works really good. thank you so much

  • @K1ngCaden
    @K1ngCaden Рік тому +3

    is there anyway to make it where if the player is a certain distance from the enemy, the enemy starts following the player until the player reaches a certain distance away from the enemy?

  • @V0rtex66
    @V0rtex66 2 роки тому +5

    my character stops at the first point, although he did the same as in the video

    • @davidnilsson2198
      @davidnilsson2198 Рік тому +2

      I had the same problem. For me the issue was that the "collider" for the NavMeshAgent was too far up on the Y-axis. Changing the offset on the NavMeshAgent (or changing the minimum distance in Update) helped.

    • @Tail1704
      @Tail1704 Рік тому

      @@davidnilsson2198 this didn't help. do you know any other way to fix this?

    • @newerr497
      @newerr497 Рік тому

      change Stopping Distance in Nav mesh Component equal 0

    • @Keuneollie
      @Keuneollie Рік тому

      Have you found a solution?

    • @V0rtex66
      @V0rtex66 Рік тому

      @@Keuneollie yes, NewErR has already written above how to fix it

  • @obisvanainobis9950
    @obisvanainobis9950 Рік тому +1

    dosent work for me, stops at the first waypoint. I see several people have the same problem but no definitive solution

  • @MaidGameStudios
    @MaidGameStudios Рік тому

    very helpful !
    very cool !
    very thanks !

  • @borhf
    @borhf 2 роки тому

    this is very helpful thanks for the tutorial

  • @CarlosGonzalez-mz2tf
    @CarlosGonzalez-mz2tf Рік тому

    anyone know how to make the ai stop for about 5 sec at each waypoint? im just having trouble knowing where to tell it to set the move speed to 0 for a few sec

  • @ercuttogameplay
    @ercuttogameplay Рік тому

    Thanjs my friend clear and easy

  • @paulojohnfernandez7380
    @paulojohnfernandez7380 Рік тому

    My enemy object is moving but it went through the wall

  • @user-os1jy5en1t
    @user-os1jy5en1t Рік тому

    Thank you very much...!

  • @Geckotr
    @Geckotr Рік тому +1

    When you use navmesh on a single plane it bakes it perfectly but when you use it on a level made out of numerous separate objects, it doesn't work so well. The solution i found for this is to place a plane to the places like a corridor where the navmesh agent couldn't bake the navmesh. Is there a better solution for this ? Btw is navmesh the only technique for the enemy AI in Unity and other APIs like UE use the same technique as well? Also thx for the great video, it helped me a lot in my project and for my learning experience in Unity

  • @h2acomunicacion
    @h2acomunicacion 3 роки тому

    How I can Implementating this to enemy chomper in 3d GameKit? is to hard put a patroll script in this enemy?

  • @requiem_for_a_dream5463
    @requiem_for_a_dream5463 2 роки тому

    Thank you

  • @nickfai9301
    @nickfai9301 2 роки тому

    Thanks for sharing this tutorial. Let say I use generic type of animal as the enemy. Can the animal move with it animation movement?

  • @jadonstudios777
    @jadonstudios777 Рік тому +2

    if anyone sees this, I have been trying this for hours and every time i try, the enemy will only go to the first waypoint.
    Can someone please help me

    • @irenesanchez8793
      @irenesanchez8793 Рік тому

      Same here, I have no idea why. For some reason the index is not incremented

    • @Keuneollie
      @Keuneollie Рік тому

      Have you found a solution?

    • @jadonstudios777
      @jadonstudios777 Рік тому

      @@Keuneollie well i did but my computer got blue screened and all my progress was gone.

    • @obisvanainobis9950
      @obisvanainobis9950 Рік тому

      wtf did you do to your PC

    • @jadonstudios777
      @jadonstudios777 Рік тому

      @@obisvanainobis9950 I think it was a virus but idk 🤷‍♂️

  • @pedra727
    @pedra727 2 роки тому

    Ur the best, Thanks!!!!

  • @APRIANSYAHAV
    @APRIANSYAHAV 2 роки тому

    whre can i dnwload this file

  • @sillyninja65
    @sillyninja65 Рік тому

    Way points seem super inefficient especially for open worlds and sandboxes

  • @robro498
    @robro498 2 роки тому

    I've used this code for my enemy, but how do i then give him a walk animation instead of sliding?

    • @whoami.....
      @whoami..... 2 роки тому +5

      just set "ur_walk_anim_name" as default and change it when enemy will shoot/hit/run etc. hope it'll work if you didn't figured it out!

  • @prabhun8
    @prabhun8 2 роки тому

    Cool

  • @herdboy83
    @herdboy83 2 роки тому +2

    idk why it's not working and i dont have error :)^:) ): :) :)

    • @jonatassantosdasilva6495
      @jonatassantosdasilva6495 2 роки тому +2

      You need to call the method UpdateDestination() in the start

    • @tjorloski1961
      @tjorloski1961 2 роки тому +2

      @@jonatassantosdasilva6495 That worked for me, thanks!

    • @AriShooDesigns
      @AriShooDesigns Рік тому +1

      @@jonatassantosdasilva6495 This worked for me as well, thank you so much!

  • @lujainalmutlaq905
    @lujainalmutlaq905 Рік тому

    thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks thanks

  • @SachalSpeaksOfficial
    @SachalSpeaksOfficial 2 роки тому

    please make video while developing the game

  • @trecheris
    @trecheris 3 роки тому

    im getting a AI' does not exist in the namespace`UnityEngine. Im new to unity and failing to understand what i find when i google it. Any tips here?

    • @trecheris
      @trecheris 3 роки тому

      I got it working, Was a simple coding error lol. Thanks for the video iv followed.

  • @pimpoplays
    @pimpoplays 2 роки тому

    please, full script to download????

    • @pixofobico
      @pixofobico 2 роки тому

      same

    • @pimpoplays
      @pimpoplays 2 роки тому

      @@pixofobico marlom! i founded a easyer tutorial, that does the same thing !!! if you want, i will pass the link!!

    • @pixofobico
      @pixofobico 2 роки тому

      @@pimpoplays I want it

    • @pimpoplays
      @pimpoplays 2 роки тому

      @@pixofobico ua-cam.com/video/UvDqnbjEEak/v-deo.html here, or just search How to make an enemy follow player - Unity NavMesh

    • @pimpoplays
      @pimpoplays 2 роки тому

      @@pixofobico i know is Enemy follow but you can use for other things!!!

  • @mehrshadking7840
    @mehrshadking7840 2 роки тому +1

    this way has a bug dont test

  • @lawrenceparry8921
    @lawrenceparry8921 3 роки тому +1

    First.