How to Make the NPC's Head Look At the Player in Unreal Engine 5

  Рет қаралды 53,686

Gorka Games

Gorka Games

Күн бұрын

Hello guys, in this quick and simple tutorial we are going to learn how to make a the AI look with its head at the player in Unreal Engine 5.
↪️Join my Discord Server, NOW: bit.ly/GorkaGa...
👉Awesome Unreal Engine courses on Wingfox: bit.ly/GorkaGa...
Check out my Steam Game! bit.ly/3rVlXU1
Follow me on Twitter: / gorkagames
Follow me on Instagram: bit.ly/Instagr...
Subscribe to the channel: / @gorkagames
unreal engine 5,ue5,npc look at player,tutorial,quixel,megascans,unreal engine head look at,eney look at player unreal engine 5,ue5 ai look at player,ue5 head look tutorial,ue5 how to make the npc look at you,unreal engine 5 npc look at player head,unreal engine 5 head look at,unreal engine 5 look at head,unreal engine 5 how to mesh look at head, unreal engine 4,ue4,unreal engine 5 head look,ue5 enemy look at player tutorial, npc head look in ue5

Пікірлер: 125
@kiddskate12
@kiddskate12 Жыл бұрын
I love that when he is doing it and when he gets an error he SHOWS the error and how to fix it amazing work I cant wait for more tutorials
@GorkaGames
@GorkaGames Жыл бұрын
thank you!
@I-VisiBomb-I
@I-VisiBomb-I Жыл бұрын
except he doesn't. my character just looks up and i haven't a clue on how to fix it.
@taskipl3802
@taskipl3802 10 ай бұрын
@@I-VisiBomb-I same did you fix it?
@SimpleDeveloperOfficial
@SimpleDeveloperOfficial 14 күн бұрын
@@I-VisiBomb-I Had a similar issue, this might fix it, go and select the Look At node and under Look At Axis, there should be something called In Local Space, try ticking that off and see if that fixes it
@SimpleDeveloperOfficial
@SimpleDeveloperOfficial 14 күн бұрын
@taskipl3802 Hey, I might have found a fix for it, go into your animation blueprint and select the Look At node, then under Look At Axis, there should be something called In Local Space, try ticking that off, its what I did to fix my issue
@ESJoell
@ESJoell 9 ай бұрын
You can forgo casting in the animation blueprint by replacing it with the "is valid" node (? kind not f) from get player character, and connecting get player character return node to mesh. It works even without the is valid node, but in all likelyhood, it will produce errors because the animation updates before the player character is loaded
@al_my_pal
@al_my_pal Жыл бұрын
Your nuanced tutorials are easy to follow and help me understand these basic but immersive features. I don't even have a decent PC for unreal 5 but I'm watching these before upgrading and diving in. You've earned a sub from me sir.
@天才變態少女东北歌手
@天才變態少女东北歌手 Жыл бұрын
set everyting to "low""low", and make game screen to smaller, it will be good word
@sabramwasdart9027
@sabramwasdart9027 Жыл бұрын
Your content is amazing for a starter in Unreal Engine like me. Thanks for taking the time to do this, legend! Subbed
@GorkaGames
@GorkaGames Жыл бұрын
thank you so much! I'm glad that you find my videos useful!
@sabramwasdart9027
@sabramwasdart9027 Жыл бұрын
One of the next videos maybe how to make a mini map in the top corner of a game? 👌🏼
@Unyverses
@Unyverses Жыл бұрын
Another Banger Brother! Another Banger
@LinuxPhantom
@LinuxPhantom Жыл бұрын
Can you give us an idea of how to set it by distance? Ive noticed it follows you when your across the map. Amazing stuff by the way!
@DeWessel97
@DeWessel97 9 ай бұрын
In the NPC animBP event graph, get the world location of the NPC & the player character, plug those into a Distance (vector) node. Use the resulting value to set a boolean variable, when the result < [ your preferred distance ]. Plug the bool into the Alpha of the Look At node. 🙂
@electronicinfection
@electronicinfection 3 ай бұрын
@@DeWessel97 And map range the distance to 0 and 1 to get a smooth alpha value for the head transition. =)
@ghostinhell666
@ghostinhell666 3 ай бұрын
@@DeWessel97 Hey thank you kindly for the great explanation!
@ty_teynium
@ty_teynium 3 ай бұрын
​@@DeWessel97 error message after compiling: uses potentially threaded unsafe call disable threaded update or use a thread safe call. Function may news BlueprintThreadsafe metadataadding.
@DeWessel97
@DeWessel97 3 ай бұрын
@@ty_teynium idk man im not a programmer sorry 🤓if its a yellow error ignore it otherwise ask google or chatgpt lol
@Blowave-
@Blowave- Жыл бұрын
Hey, I've done this tutorial, but the character instead of looking at the player, it looks up and when I move around it, it avoids looking at the player, can you pls help?
@furioarts
@furioarts 6 ай бұрын
Had same. Search for "in local space" not ticked in lookat node
@ghazalmajidi
@ghazalmajidi 5 ай бұрын
@@furioarts Lifesaver!!!! Thank you!!
@RaulMartinez-bt3vm
@RaulMartinez-bt3vm Жыл бұрын
Nice content Gorka, I love your tutorials, you come up with interesting content and you explain it very well! A few things, can you expand on the functions of this video tutorial to make the player character have a head tracking mechanic so the head of the character follows the camera? Also, I'm looking forward to more of your parkour mechanic tutorials like the vaulting video you made some time ago.
@procrastinator24
@procrastinator24 9 ай бұрын
great video, thanks! I was trying to replicate all of that on my own in my Anim BP, glad I found your video to show me a much quicker and more simpler way!
@draicor
@draicor Жыл бұрын
Hey mate, good tutorial, I love how you explained some of the nodes too.
@beckhanra
@beckhanra Жыл бұрын
Thanks mate! Used this tutorial to make player characters head follow the camera: camera world location, forward vector multiplied by some etc, from your line trace tutorial. Works like a charm
@ASTRAL15293
@ASTRAL15293 11 ай бұрын
what can i do if the head rotates reverse???
@miquelsalvatejedor3123
@miquelsalvatejedor3123 6 ай бұрын
Love you Gorka! just what i needed! Aupa ahi!
@KANAWA2025
@KANAWA2025 6 ай бұрын
all simple and cpntruct - good job bro!
@dontribal739
@dontribal739 2 ай бұрын
How do you adjust the range of when the NPC looks at you? Currently, the NPCs all stare at my player when I'm far away. How do I make it so they don't look until I'm closer?
@buennyo
@buennyo 5 ай бұрын
Thank you so much for your work and help! ❤
@larabatech1200
@larabatech1200 7 ай бұрын
mindblowing as usual
@rocketpoweredchimpgamesphi7798
@rocketpoweredchimpgamesphi7798 Жыл бұрын
Great and simple as always! Thanks Gorka! :o)
@FactSlash
@FactSlash Жыл бұрын
This is so cool thanks keep up the good work, and congrats on 18k subs.
@GorkaGames
@GorkaGames Жыл бұрын
thank you so much!
@FroiDevUE
@FroiDevUE 2 ай бұрын
Again, saving the day 🙏🙏
@imercutio
@imercutio Ай бұрын
Awesome tutorial. Would be great to see how this works for First Person.
@fnafbusters8208
@fnafbusters8208 2 ай бұрын
Very helpful Tutorial! Only one quesstion, if I want to use the Look at feature on a Blendspace, what would I need to connect to the second pin in the blend layer per bone?
@AliBounds
@AliBounds Жыл бұрын
I was just playing street fighter the other day thought that was cool. Now im here
@wolfiedgr8t
@wolfiedgr8t Жыл бұрын
Excellent man,thanks for the great tutorial ♥
@hardcoregamer739
@hardcoregamer739 Жыл бұрын
I know I'm a couple months late but do u know how to restrict that animation to distance?? As in I want the NPC to look at me when I get in their vicinity, it would be exceedingly weird if u just walk in a marketplace or just down the street and every single soul(NPC) is staring at u XDXD. Thanks in advance!!!
@NOOBIEPIE
@NOOBIEPIE 2 ай бұрын
Idk if you found out, but you can add a sphere collision in your NPC BP and set it to only overlap pawn, and then from there you can set a boolean variable to decide if the player is in range or not
@thejusticesong4696
@thejusticesong4696 22 күн бұрын
additionally you could calculate the distance between the character and your NPC and adjust the blend you find in the look at node to make it fade in using the distance
@theoldrsftw
@theoldrsftw Жыл бұрын
I always wondered how to do this. Thank you for the guide.
@electronicinfection
@electronicinfection 3 ай бұрын
Does anyone notice the npcs head turn to the left (right from pov of npc) is kinda limited compared to the other side? Feels weird. Maybe it has something do to with the idle aimation or ue5 mannequin?
@ty_teynium
@ty_teynium 3 ай бұрын
2:03 get player character ---> get component by class [Static Mesh Component ] --> get socket Location?
@guxango8630
@guxango8630 Жыл бұрын
First comment. Great video!
@GorkaGames
@GorkaGames Жыл бұрын
thank you!
@kimochisaiko6442
@kimochisaiko6442 Жыл бұрын
great as always
@javisartdesign
@javisartdesign Жыл бұрын
Nice and easy trick! thanks
@GorkaGames
@GorkaGames Жыл бұрын
my pleasure!
@Moctop
@Moctop Жыл бұрын
That's nice but how to you blend it into an existing animation?
@EisonDoesEverything
@EisonDoesEverything 10 ай бұрын
Could use an animation notify state and then send it via a blueprint interface which sets the value you need on notify begin and notify end.
@lga9046
@lga9046 5 ай бұрын
One question. I have an instance of NPC that I have coded to do several random anim sequences as they roam the level, and after assigning this new ABP_AI_Look anim to them, I find that the animation sequences that are playing are overriding the ABP_AI_Look code to look at player. They play normally without the head moving. How can I make it so those sequences are also affected by the Look To Code in the Animation BluePrint?
@twoorobbie
@twoorobbie Жыл бұрын
Do you have one where your character could turn their head im trying to go for a realistic type of game but can’t find any videos on it
@JeffreyZweigII
@JeffreyZweigII Жыл бұрын
Head seems to freeze in the position of where my player starts, and does not move after that. any idea why it's doing that?
@IMoresoft_Studio
@IMoresoft_Studio Жыл бұрын
Thank you
@GorkaGames
@GorkaGames Жыл бұрын
my pleasure!
@christofferplatou2828
@christofferplatou2828 Жыл бұрын
Dope, thanks! How would I make this a variable so it wouldn't always be on?
@killerthepro756
@killerthepro756 Жыл бұрын
Great vid and when will you make the hotbar and what are the details just to expect a good video
@GorkaGames
@GorkaGames Жыл бұрын
soon hopefully man!
@killerthepro756
@killerthepro756 Жыл бұрын
@@GorkaGames Great but what are the details of the hotbar video
@TolisPiperas82
@TolisPiperas82 Жыл бұрын
I hope will add it in the ai of the rpg series in the future?
@GorkaGames
@GorkaGames Жыл бұрын
yes!
@TolisPiperas82
@TolisPiperas82 Жыл бұрын
@@GorkaGames when is the next rpg video?
@kenalpha3
@kenalpha3 Жыл бұрын
My head bone is -Y down, +Z forward (eyes forward). And +X is left ear. What do I put for Look up Axis or Look At axis? (I tried all 3: X only (1, 0, 0), Y only (0, 1, 0), or Z only (0, 0, 1). But my AI neck is not rotating along the Y axis, it is tilting sideways.) [Edit 2: #2 solved. But #1 and 3 arent] 2) My AI is a child of my char BP (thus its anim BP uses same as Player). So what is the logic that if self = Player (human), then dont do the neck turn? Do I put that check in Event Graph or AnimGraph? I dont see the node (in AnimBP terms) to [get self] or [get is player] node, so I can add a Bool branch.) Ty Edit 2: The Bool in Event Graph has to be before the Cast To. So before his CastTo 1:38, add [Get Owning Actor] == [Get Player Character]. Feed that into a Branch. (If the Owning Actor of the AnimBP equals Player Character, then True for the Branch.) Then make and set a new Variable called "Is Player?" (this Var is needed to fix my problem of not being able to add the same == check nodes in Anim Graph.) So then in Anim Graph, add [Blend Posses by bool]. Drag in "Is Player?" at red pin. At True Pose, add a Saved CachedPose of BEFORE the head turn code. And at False (if we are not player - then we will use his head turn code), connect the Output of his Head turn code. Then the Output of [Blend Posses by bool] connects to your final [Output Pose] node (running guy icon). I also added a 2nd Look At node for Spine1, Clamped at 10. And I split the Z pin of "Look at POS." I subtract 50 before it plugs into the 2nd Loot At node (for spine1, since it is lower than head/eye height, I dont want the spine tilting up too much). ==============OLD Edit: I did try putting Blend Posses by Bool in AnimGraph, with a bool and [Get Player Character] == [self]? But it gives a warning for using [Get Player Character] node in AnimGraph: _"Node Blend Poses by bool uses potentially thread-unsafe call Get Player Character . Disable threaded update or use a thread-safe call. Function may need BlueprintThreadSafe metadata adding."_ I also put the Bool in Event Graph, but it seems to do nothing for true vs false.
@kenalpha3
@kenalpha3 Жыл бұрын
How do we reduce/clamp the Tilt chin up/down more than the Twist neck (rotate)? They use the same value = unrealistic. When my player is very close and jumps, the AI chin tilts up too fast/too extreme, even with Interpolation time = 10. The Clamp angle is too big for Chin up. I want to reduce it by 1/2. Because irl the eyes will move up before the head tilts up - thus the chin will not tilt up so extreme/fast. But in UE, they are treating the neck Twist and Tilt up as the same value.
@NotSVGames
@NotSVGames Жыл бұрын
Is this video applicable for the rpg series??
@RSProduxx
@RSProduxx Жыл бұрын
of course
@GorkaGames
@GorkaGames Жыл бұрын
yeah!
@chavlaz
@chavlaz Жыл бұрын
it works;... but it's all inversed. any ideas?
@nihilepsy3053
@nihilepsy3053 10 ай бұрын
Is there a way to make him only use 1 rotation axis like yaw
@차승준-m9g
@차승준-m9g Жыл бұрын
Thank you, look at.
@GrimsinxGaming
@GrimsinxGaming Жыл бұрын
Just spot on tutorial thanks so much.. My AI character when he runs its a loop can help fix please
@mechuxxxxxx
@mechuxxxxxx Жыл бұрын
hi, great tutorial, can you add how to limit his range when he start looking, because it will gonna look weird with a room full of people constantly watching you at every second :)
@kenalpha3
@kenalpha3 Жыл бұрын
Same. I wish he'd show/code the features/pre answer the basic questions that most modern games already have by 2023 - to make it a complete tut. Because I see a lot of people asking the same thing. I semi know the logic, but not how to implement in Anim BP, because the nodes are kinda restrictive/backwards compared to Blueprint code. Thus I am left wondering with you. Also he's using CastTo player, and only showing how this works against a single target (Player). By 2023, someone knows how to code it for Wildcard/BPI - look at whoever the AI is currently looking at (e.g. last interacted Actor/Player or closest distance). But again, I dont know how to implement that in AnimBP. So it's frustrating when I know the answer/code exists, but not shown, so I must keep searching.
@heresmynovel331
@heresmynovel331 Жыл бұрын
Have you found any answers please???
@mechuxxxxxx
@mechuxxxxxx Жыл бұрын
@@heresmynovel331 nope, i just stoped watching his tutorials, because its getting me nowhere above things he is showing
@mechuxxxxxx
@mechuxxxxxx Жыл бұрын
@@heresmynovel331 and i bought udemy course unreal blueprints 101 so im aproaching this problem with learning from the beginning
@georgebessinski2122
@georgebessinski2122 Жыл бұрын
Anybody knows how to implement it inside behavior tree, so that npc only looks at the player if he`s in line of sight?
@badboy-sc7gt
@badboy-sc7gt 3 ай бұрын
i have a problem when player 1 jump NPC's looking up, but when player 1 crawl position, NPC'S not looking down? so why
@zeeshankhan-gw2lv
@zeeshankhan-gw2lv 9 ай бұрын
Great thanks
@muneebhero1159
@muneebhero1159 Жыл бұрын
Can you teach how to make score or points system
@kriswintf2027
@kriswintf2027 Жыл бұрын
but how to Attach pawnsensing component to head bone?
@ryansaper
@ryansaper 11 ай бұрын
I have a problem where my character looks at me, but once he interacts or touches anything, he freezes in that position and nothing animates on him. This only happens with the look at player system, but it's fine when I remove it from the abp.
@MilanKarakas
@MilanKarakas Жыл бұрын
Excellent!
@ulurag
@ulurag Жыл бұрын
Can you make a video about how to child collision components so they move together with the mesh as it animates, like if you have a bird and put a capsule collision on the beak and as the bird moves into different poses the capsule collision component moves and rotates with the beak of the bird wherever it goes?
@kenalpha3
@kenalpha3 Жыл бұрын
Do you mean a Character? > SK mesh? And which engine? Im using modular meshes in UE4.27, with Set Master Pose component/function. Which means I have my default SK player "mesh." Then I added a child mesh. But when I imported, they share the same skeleton (but different parts of the mesh are filled in. E.g. just body mesh or just hair mesh). Thus the Set Master Pose node syncs their animations together to use only the anim BP set for "mesh" (and saves processing.) But you can apply different physics to the child meshes, like wiggle hair, something in the bird beak. But UE4.27, their default physics is very extreme/buggy unless you fine tune 100 settings that they dont explain. Idk if they fixed in 5.1. But there is an addon called Kawaii physics. It may be easier to setup like I said above, then use Kawaii to make the [worm/beak] wiggle - connected to the main SK mesh body/move with the animation - let have some independence.
@brightboy18
@brightboy18 Жыл бұрын
Maybe you already have a video but is there a way to make the NPC/Boss AI body always face the player
@QuailCraft
@QuailCraft Жыл бұрын
I'm having an issue where look at, setting the interpolation time does nothing. its set to 3000 and the head snaps instantaneously.
@Cemrekartworks
@Cemrekartworks Жыл бұрын
Hello, I just discovered you. I'm kind of new to the gaming industry. I am improving myself thanks to your content. I'm planning to make a horror game. Can you tutorial some more content about this? Things like jumpscare, moving objects, turning lights on and off, interacting with objects. + Subbed. I'm thinking about making a donation in the future for you. Thank you.
@LuciousKage
@LuciousKage Жыл бұрын
Niceee! does that work other way around too ? if i want my character to look at someone ???
@bazio5592
@bazio5592 Жыл бұрын
Maybe locomotion system next ?
@GorkaGames
@GorkaGames Жыл бұрын
check my RPG #2!
@jesseyules
@jesseyules Жыл бұрын
Hi! Q: What settings should we change if we're using BP First Person?
@simu_lacra
@simu_lacra Жыл бұрын
The only thing you have to change is to cast to your FirstPersonCharacter BP instead of third person in the event graph.
@Slaysh3rxx
@Slaysh3rxx 10 ай бұрын
How can we do in fps ? İ worked too much but cant do :(
@АндрейКислов-б4з
@АндрейКислов-б4з Жыл бұрын
The head is looking in the opposite direction, how to fix it?
@SafixGames
@SafixGames 11 ай бұрын
Same..
@projectMAINCORE
@projectMAINCORE 11 ай бұрын
cast to third is not showing up so its not working anymore.
@BLOG_BAR
@BLOG_BAR 9 ай бұрын
how to do this with the character's head, the same mechanics do not work, it tears off the head
@cyanicgames5224
@cyanicgames5224 11 ай бұрын
I dont know why but the way my character looks at player seems to be inverted? It looks to the opposite direction, when he is on my left side the character tilts head to their right side. Any idea how to fix this?
@stibaer573
@stibaer573 11 ай бұрын
Had the same problem. I was able to solve it by going into the AnimationBluePrint, AnimGraph, selecting the yellow LookAt and on the right side under Details under LookAtAxis, changing the Y-Axis from 1,0 to -1,0. I hope this helps.
@rashidfarhan6223
@rashidfarhan6223 3 ай бұрын
this is soo easy in unreal and kinda hard in unity
@TrespasserAlt
@TrespasserAlt Жыл бұрын
for some reason my character is looking up while tracking the player, pls help.
@Mr.Chris_PL
@Mr.Chris_PL 8 ай бұрын
Make sure to select the look at node and in details in look at axis part disable in local space, worked for me.
@screenapple1660
@screenapple1660 Жыл бұрын
Wait... how do you make a player turn its head on enemy and far away head turns with mouse?
@alejandrogarcia4394
@alejandrogarcia4394 Жыл бұрын
Hola Gorka, no sé si puedes ayudarme. Me gustaría hacer una fila de personajes andando por un mismo recorrido (spline) y que paren cada 2 segundos y luego continuen andando y que vuelvan a parar y asi, todos en fila uno tras otro. He visto ya 20000 tutoriales y no encuentro el modo. Podrías recomendarme alguno? Te estaría enormemente agradecido tio. Un saludo.
@RSProduxx
@RSProduxx Жыл бұрын
nice
@GorkaGames
@GorkaGames Жыл бұрын
thanks!
@XjjxHxhdusi
@XjjxHxhdusi 23 күн бұрын
My medal have 2head(head’headTop_End) if I use head he look up to sky
@allashama
@allashama Жыл бұрын
this technicle doesnt work if your target to look at is an object without head bone. The AI will look up in the sky instead of looking at target, even with the Actor Location. If someone know the tip to make the AI looking at a target instead of a head bone. Thanks!
@I-VisiBomb-I
@I-VisiBomb-I Жыл бұрын
I have a head bone and it still just looks up.
@emptybruh
@emptybruh Жыл бұрын
@@I-VisiBomb-I Yea for me, not sure whats going on, have you figured it out? The problem is caused by Mixamo rig joints being wrong orientation
@Mr.Chris_PL
@Mr.Chris_PL 8 ай бұрын
For the looking at sky just make sure to select the look at node and in details in look at axis part disable in local space, worked for me.
@FoxoticTV
@FoxoticTV Жыл бұрын
Nice but you forgot to mention how to do this within proximity, they're always gonna look at you even 100000 miles away.
@2010Edgars
@2010Edgars Жыл бұрын
My npc enemy looks with degree offset.
@g-dojjo
@g-dojjo Жыл бұрын
Thanks for tutorial!! :3 but i have a weird problem with rotation way :D My AI looking at to reverse side :D When my player right AI looking at Left side :D
@g-dojjo
@g-dojjo Жыл бұрын
Okey im fix it lol :D If your AI looking at another way just adjust : In "AI" Anim Blueprint---Anim Graph--Look At(NOD)Click it--at Right Panel Find"Look At Axis" in Skeletal Control--Change Axis! mine is "Y" "-90"
@nassergreatdeveloper3745
@nassergreatdeveloper3745 Жыл бұрын
3:23 🤣🤣🤣🤣🤣
@wallacejvm
@wallacejvm 10 ай бұрын
Casting in update animation is not a good practice, it will make you lose a lot of performance in the blueprint
@gail_blue
@gail_blue 9 ай бұрын
For April fools, you should make a video that's hard to follow.
@I-VisiBomb-I
@I-VisiBomb-I Жыл бұрын
like someone said before, the character just looks up at the sky all the time. this is disappointing...
@sideeffectstudios7236
@sideeffectstudios7236 8 ай бұрын
Nice tutorial but it didn't work
@TheDudeAbides421
@TheDudeAbides421 Жыл бұрын
Algo
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
How To Make The AI Head Follow The Player | Unreal Engine Tutorial
12:07
The Easiest Way to Make a Simple Enemy AI in Unreal Engine 5
15:40
Gorka Games
Рет қаралды 307 М.
How to Use PawnSensing Sight for Your Enemy AI in Unreal Engine 5.3
6:27
Keltick's Game Dev
Рет қаралды 1,4 М.
AI Random Roam | Basic Roaming - Unreal Engine 5 Tutorial
5:33
Matt Aspland
Рет қаралды 66 М.
Unreal Engine Simple NPC Tutorial
14:03
Seredias
Рет қаралды 63 М.
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 130 М.
AI Sight Detection And Chase - Unreal Engine 5 Tutorial
7:33
Matt Aspland
Рет қаралды 65 М.
5 Tricks you (probably) don't know about Unreal Engine 5
10:44
Cinecom.net
Рет қаралды 405 М.
How to Make a Simple Dialogue System in Unreal Engine 5
16:32
Gorka Games
Рет қаралды 103 М.
How to Make a Simple Behavior Tree in Unreal Engine 5 - Advanced AI
20:47
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41