How To Make The AI Head Follow The Player | Unreal Engine Tutorial

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

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

  • @MattAspland
    @MattAspland  3 года назад +17

    A simple fix for a minor bug in the code: imgur.com/a/0YOfRrq
    Please read the above link, I have explained it all in there. The bug is that if the AI is facing a different direction, it won't work perfectly, this fixes that issue.
    I only noticed this after uploading the video, so my apologies for not covering it in the video, but I have fixed it for you already. All the best to you all, stay safe!

    • @zoravibes
      @zoravibes 3 года назад +3

      Not a fix as the AI still looks off in other directions if oriented toward + or - X.

    • @stephenmontague6930
      @stephenmontague6930 2 года назад +9

      Hey, could be wrong, but here's a simple fix : Just subtract [FindLookAtRotation, Z (Yaw) - GetActorRotation, Z (Yaw)] in the AnimBP.
      You'll need to use a TryGetPawnOwner node (same as before) to do the GetActorRotation, and Make sure the Order of subtraction is correct.
      I've tested with an AI facing 4 cardinal directions, world (x, -x, y, -y) and it always turns to the player now.
      Thanks for the overall setup. Still a "Liked" video. Good luck.

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

      my problem is that there is no asset details tab. im stuck on step 1. why dont i have an asset details tab?

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

      @@errormachine5056 It's either hidden behind another tab or closed - try going to Windows > Details.

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

      @@stephenmontague6930 thanks buddy!

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

    My AI are going to be so fleshed out by the time i watch all of your AI videos. Thank you!!

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

      That's great to hear man! So happy to help! :)

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

    Thanks so much for this man! This is exactly what I was looking for! Literally thought "Has Matt posted a head rotation tutorial?", and here it was! Massive thanks dude, you're the best! 😊

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

    Thanks for another cristal-clear tutorial Matt ! This helped bringing aim offset to my clones & droids =D

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

    jesus christ, i googled this and lo and behold Matt’s just uploaded again 😂

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

      Hahaha glad to hear Google likes me lol

  • @Anonymous-mf8ip
    @Anonymous-mf8ip 3 года назад +3

    This is awesome!

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

    Nice tut! You can also do this by using "Transform (modify) bone" in the anim graph of the animation blueprint, if you don't want to make the pose assets and aim offset.

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

      You are God, it is too simple. thanks

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

    You've once again done a great job of explaining a useful animation technique. Thanks, Matt!

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

    Dunno if it would be easier using control rig and moving the face by using Aim Math node and using the target as an input?

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

      Possibly yeah, I haven't messed about with UE5 and control rigs massively just yet, great idea though!

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

    Thank You so much!

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

      Always a pleasure to help :)

  • @TorQueMoD
    @TorQueMoD Год назад +2

    This is an overly complex way to get an NPC to Look at the player that also requires you to make custom animations to cover a multitude of scenarios. Like what if you want the NPC to look at the player while walking? The easier method is to simply GetActorLocation of the Player Reference you made and promote this to a variable called LookLocation, then in the AnimGraph add a "Look At" node in between the Locomotion State and the Output pose. Highlight that node and where it says Look At Location under the Target category, click the Bind drop down and select Expose As Pin. Plug your LookLocation into the pin and set the Bone to Modify to the Neck bone. Then Under Look At Axis, uncheck the Local Space pin, set the Look At Clamp to 50 and interpolation time to 0.25. Done, and it'll work with all animations.

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

      omg that was easy, thanks

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

      Interpolation time is broken as it can't be set, there seem to be a bug. even if you set 500 the look at will still snap

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

      works perfectly thx

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

    Thank for th tutorial! This save me a lot of headhache!

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

    Hey Matt, could you make a video on how to incorporate multiple skeletal meshes into a character blueprint? I'm trying to make a gun that has it's own animations and still attach it to a bone on a character, thanks as always!

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

    Hey Matt thank you for your tutorials i learned alot from you and you explain everything very well
    i want to ask if you can make a tutorial about animations in First Person where you interact with objects for example you open a door and your fps hands interact with the door or you climb a ladder what ever i want to know how to get the correct position between the character and the object for the animation to look smooth
    i have watched your ladder tutorial for TPS but it is not what im looking for
    Thanks!

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

    You are a legend!!!!

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

    thank you sooo much

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

    Can you do one on the character head rotation with the mouse-gamepad?

  • @KWang-yy2qk
    @KWang-yy2qk 3 года назад +1

    Thanks for sharing, I followed the Tutorial a few times and also added the bug fix. It still doesn't work. Any hint on troubleshooting?

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

      ruclips.net/video/FxyRzooc-lM/видео.html (Works perfectly!! A quarter of the work, and can look up and down without ANY bugs!

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

    I've been using this method for days now and it isn't working properly. I came across your video and was hoping you might understand why....basically I need the Pitch Value off it to adjust the aim for a small creature so that a Zombie swings downward at it....I used the same method you did but the Pitch value returned seems to be incorrect....it's too small. I'm not sure I understand why either.

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

      Know what scratch that, I had the Pitch disconnected on the Anim Instance Side lol

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

    Hot to rotate eyes like that? I got bones for each eye and i want eye to move when enemy is goin around me and vice versa

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

    Hey matt not been here for a while haha pc has been broke😂😂

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

    Trying to animate a tripod robot. Do you think this tutorial will work with that?

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

    Amazing!!! I think I can use this to create a leaning aditive for my walk/run BS, thank you bro, you are the best!!!

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

      That's amazing to hear bro, always great to see people advancing their knowledge! All the best to you man, glad I could help out! :)

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

    sometimes small things stump me. like you went immediately into the asset details tab. i dont have the asset details tab. how do i get it to appear?

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

    So Im tying to get this to work with my VRmotionController Pawn but the ai head isnt tracking my vr head... any idea what I could do?

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

    Could this method be used at the AI’s waist to simulate AI aim offset? As in get enemy shooter AI’s to shoot up at me if I am above them, and down at me if I am below them?

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

      Hey. this could absolutely be used for that yep. If I'm understanding you correctly, I made a video on this previously :)
      ruclips.net/video/PZqzhGhANx4/видео.html

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

    having a problem where it is not accounting for the actors rotation. so while my actor is facing north, it works just fine, when he faces south it appears as if the values are inverted so instead of looking left to face me, he faces right away from me and transitions to the other side as i cross his line of sight. any idea what that might be?

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

      The video in the link below works perfectly!! It doesn’t require any animations, it’s not even a quarter of the work, and the AI will even look up and down at you without ANY bugs!
      ruclips.net/video/FxyRzooc-lM/видео.html

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

    Can you please make tutorial how to make isometric game?

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

      Nice idea, I can look into it for the future

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

      @@MattAspland i can't find anything about that on UE forum and YT

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

    My ai does not look in the correct direction as my character. Can anyone help?

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

    UE5 anim offset 1d wont budge at all. Don't know whats wrong.

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

    Could you make one more video on advanced Graphics menu??? Actually the old one doesn't look so good.. don't take me wrongly, it's not bad at all!!

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

    poggers, love ya

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

      All the best to you brother!

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

    Even with the “fixed” code the AI will not look right at the player unless it is oriented toward the Y axis in world space…

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

      The video in the link below works perfectly!! It doesn’t require any animations, it’s not even a quarter of the work, and the AI will even look up and down at you without ANY bugs!
      ruclips.net/video/FxyRzooc-lM/видео.html

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

    Cool

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

    tks Dude, its help me..
    please make AI to attack us

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

    Doesn't work in UE5 (at least for me)

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

    Oooh so that's how.

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

      Yeah more simple then you might expect! All the best to you :)

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

    Doesnt work! Acessed none in YAW

    • @KWang-yy2qk
      @KWang-yy2qk 3 года назад

      Same here. did you find a solution? :)

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

      @@KWang-yy2qk Dont work, i cant find a solution.

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

      @@TonyDevGame
      ruclips.net/video/FxyRzooc-lM/видео.html
      Works perfectly!! A quarter of the work, and can look up and down without ANY bugs!

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

    .

  • @buennyo
    @buennyo 5 месяцев назад

    Thanks so much! ❤

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

    Thank you so much 💓