How To Make Something Always Face The Player In Unreal Engine 5 (Tutorial)

  Рет қаралды 12,225

Matt Aspland

Matt Aspland

Күн бұрын

Hey guys, in today's video I'm going to be showing you how to have something always be facing the player in Unreal Engine 5. This could be for a talking NPC, a horror game where you are being watched, or anything you like!
Get access to the project files and more on my Patreon: / mattaspland
#UE5 #UnrealEngine5 #UE5Tutorial
_________________________________________________________________________
What I use:
⌨️Keyboard: amzn.to/3TMYuly
🖱️Mouse: amzn.to/3JNYgWD
🎧Headphones: amzn.to/3z8OfhM
💺Gaming Chair: amzn.to/3M1VM9V
🎙️Microphone: amzn.to/3FSxnQ8
🎙️Mic Power Supply: amzn.to/3FTXt5f
🖥️Monitor (X2): amzn.to/3LSsMkT
🖥️Monitor (X1): amzn.to/3FSd9WS
🦾Dual Monitor Arm: amzn.to/3nvABCC
🦾Monitor Arm: amzn.to/40pKJvi
📷Webcam: amzn.to/3lIlRA2
📷DSLR: amzn.to/3lKbjQI
🔥Cable Management Tray: amzn.to/3ZwzEaQ
🔥Cable Management Sleeve: amzn.to/3M6U5Yu
My PC Specs:
GPU: amzn.to/3JHLHMx
CPU: amzn.to/40hcupY
RAM: amzn.to/40iHd67
Motherboard: amzn.to/3FRne6e
_________________________________________________________________________
🔥Subscribe: / @mattaspland
💬Discord: / discord
🐦Twitter: / matt_aspland
📷Instagram: / matt_aspland_
🔗All: linktr.ee/MattAspland
_________________________________________________________________________
Support Me:
Patreon: / mattaspland
PayPal: www.paypal.com/paypalme/matta...
Ko-Fi: ko-fi.com/mattaspland
_________________________________________________________________________
To access the project files and screenshots from the video, check out my Patreon above!
My Public Video List: trello.com/b/7vJgXzBm
Unreal Engine 4 Tutorials Playlist: • Unreal Engine 4 Tutorials
Unreal Engine 5 Tutorials Playlist: • Unreal Engine 5 Tutorials
The Basics Of Nodes Playlist: • The Basics Of Nodes In...
_________________________________________________________________________
♫ Outro Song: Kronicle - Chill Noons

Пікірлер: 33
@MagmaProductionsYT
@MagmaProductionsYT Жыл бұрын
I WAS LITERALLY JUST NEEDING THIS! THANK YOU!
@orccomputers2145
@orccomputers2145 Жыл бұрын
love your work
@fl1nch_155
@fl1nch_155 Жыл бұрын
I was searching for this yesterday and didn’t find anything this is perfect timing!
@rifat.ahammed
@rifat.ahammed Жыл бұрын
Great. Thank YUU
@Lifefire.
@Lifefire. Жыл бұрын
Good tutorial, i hate to be that person but there is a flaw present in the example. If you do not compare the "End Overlap" actor to the current actor variable then another character that briefly overlaps and exits the sphere will cause the timer to cancel. This will affect both multiplayer and things such as a npc that has the ability to wander around on it's own if they are of class Character or a child class of Character
@kenalpha3
@kenalpha3 Жыл бұрын
1) So whats the fix? [I added a Delay = 1 > Clear Timer.. , after Set Actor Rotation. So that it allows NPC one second to rotate, then times out (expires), which allows another Player or same Player to trigger the event again (which sets the new Temp Actor var). Thus if Player 1 interacts with NPC while NPC is rotating to Player 0, then Player 1 becomes the new rotate target.] 2) What is the theory logic to use for multiplayer - to determine NPC priority of who to rotate to? Im thinking either Last Player to interact with NPC, or closest Player to NPC. Thus if Player 0 interacts with NPC, while Player 1 is nearby (but didnt interact yet), then NPC faces Player 0. But if Player 0 interacted, then walked 100 units away, then Player 1 interacted (closer to NPC), then NPC does the priority rotate to Player 1.
@Lifefire.
@Lifefire. Жыл бұрын
Multiplayer would be more complex due to the varying types of npcs you can have, for example a quest giver npc only needs to visually rotate client-side that way each player can see the npc looking at them... npcs that are attacking for example need to replicate their rotation to the proper target player that had the npc's focus... the main goal of my reply was more about other actors (even in a single player game) that are of the class "Character" can give unintentional end overlap results if the (begin overlapping character != end overlapping character)
@kenalpha3
@kenalpha3 Жыл бұрын
@@Lifefire. >for example a quest giver npc only needs to visually rotate client-side that way each player can see the npc looking at them. In Lineage 2, didnt the Gatekeeper NPCs rotate to Last Player interacted, and all Players saw who she was looking at? (Thus for me, I would add the rotate code even for quest/non combat NPCs.) So what is your solution for your original reply? I was thinking use tags in AI/NPCs. Can Interact Player, Can Interact NPC, Busy Interact, and Enemy. If store NPC has only Can Interact Player, then no other NPC can interact with store (since no need). And if only one player can interact with an NPC< then he gets a Busy tag set during the code, while Player has the interact window open. E.g. for trades (if only 1 of something existed).
@regbagshaw423
@regbagshaw423 6 ай бұрын
Hey Matt, always great tutorials man. Can you do a tutorial having a companion ai roam randomly within a certain distance of the player?
@PatrickTheDM
@PatrickTheDM Жыл бұрын
I very well may add something with this before finalizing my Maze game. 👍
@silentgaming5610
@silentgaming5610 24 күн бұрын
Nice tutorial Matt! Got a question. How can you make it to stop facing the player (no rotation) when the player looks at it? How would you implement/add it to the blueprint? Thanks in advance!!
@Steelersfan355
@Steelersfan355 28 күн бұрын
how does one set it so the player faces the object for example the player gets grabbed from behind the player faces the target. Ive tried to subtract the control rotation on the Z of the player from the aggressors control rotation on the z but only at certain degrees on the yaw will the player turn to the correct rotation
@yamikanikalonge2346
@yamikanikalonge2346 Жыл бұрын
Hi Matt I was watching one of your old tutorials on making a character move to a location I wanted to ask if you know how to use that implement the Batman Arkham games style of free flow combat?
@stealthgamesaremyjam145
@stealthgamesaremyjam145 23 күн бұрын
I'm having a little issue, everything is working but, I have placed in my level characters I've made to be stood in certain location and facing in a certain direction. after implementing this code, when I start the level all the characters I've placed face in the same direction and not the initial direction.
@yearight1205
@yearight1205 Жыл бұрын
Hey Matt, I'm hoping you can help me out with something. I am trying to create a short film, and in it a huge dragon is walking with his wings on the ground (think of those dragons where their hands are at the mid point of their wings), and I need the ground to turn to rubble and kick dirt and rocks up. So I went to try and tinker with fracture, as well as Niagara effect, but I can't make anything look quite right, as well as I'm not sure how that would even be able to be built for sequencer. Any chance you could offer some advice?
@pawpotsRS
@pawpotsRS 9 ай бұрын
how can you get the reference for example the head only that will follow you? do you need a control rig for that to use as reference?
@demiplume
@demiplume Жыл бұрын
I made something similar to this, an actorComponent "RotateTowardActor" with defaults on player. It's useful because Text then is always visible.
@PatrickTheDM
@PatrickTheDM Жыл бұрын
I'm on version 5.0.2 and I only got a slight movement from the AI each time I entered the circle. I mad sure looping was ticked, but it seemed to not be looping. I resolved this by adding the custom event "Rotate" node after "Set Timer Handle" and it works great. It works with or without looping ticked. I unticked looping to prevent possible double work in the code. This only works with a skeletal mesh though and does not resolve the issue if a static mesh is used. I'm going to try the older version of this tutorial to see if it works with static meshes. UPDATE: So to get it to work with a static mesh, I just had to change "Get Actor Rotation" and "Set Actor Rotation" to "Get World Rotation" and "Set World Rotation" with the static mesh in the blue print as the target. Make sure the static mesh is set to movable as well. Make sure looping is ticked and you do not need the "Rotate" node after "Set Timer Handle."
@StudioPA
@StudioPA Жыл бұрын
help! how about the opposite of this? like your player camera will look at ai right on activating a trigger? how to do it?
@fungusfinder
@fungusfinder 8 ай бұрын
This didn't work for me at all on 5.3 with AI Perception activated. My AI still just shoots off into the distance and only turns to me if I start to pass his 90, a total of 4 turns in a 360 radius, which is I think worse than his regular AI Perception traits.
@kenalpha3
@kenalpha3 Жыл бұрын
Good job. I had to make my own version to fix AI HP bars that are set up wrong. I connected mine to an Event Tick. (And no collision/proximity check.) 1) So does [code connected to] Event Tick (which has Delta seconds pin) use the same resources as anything using Delta seconds (your version)? 2) Or does [code connected to] Event Tick use more resources, since mine doesnt have the proximity check, thus as he said, [the Tick] is always running - thus takes more resources? 3) You used CastTo Character (generic), which I think is good/safe to avoid the problem when we have multiple child Character versions. But is there a better way to avoid CastTo? 3b) Would a check of [Actor has tag, or Actor of class] cost more resources, and thus not worth it to use (to avoid CastTo)? [What his vid or my method fixes: Widget rendering is annoying. If you add a HP widget to a Char BP, and set to Screen space (so it always faces player), then it also shows through walls 100000 units away - which is wrong. So we need to set the widget to World space, but then fix it so it rotates to Player.]
@kenalpha3
@kenalpha3 Жыл бұрын
Anyone know why changing Interp Speed has no effect? (Im making NPCs that rotate to Player when touched.) At Set Timer > if Time = 0.01, then the rotation effect is too jittery when Target is at a different Z than Self (even with Z pins split). So I set Time = 0.005 or 0.001. But then Interp Rot is near instant. (I want a 0.5 or 1 second spin - more natural.) So I tried setting Interp speed to 0.1, 0.01, 100 - they all have the same effect, which shows that the Interp speed is not doing anything - it is the Time that affects it more.
@milantiquestudios7460
@milantiquestudios7460 4 ай бұрын
Instead of the whole blueprint, how would I make part of the blueprint move? I have an eye thing and I just want the eye ball to watch the player rather than the whole eye
@timo_b3
@timo_b3 17 күн бұрын
same problem here
@1994Persona
@1994Persona 4 ай бұрын
Hello, i want to ask how is possible to make two playable characters to be attracted to each other
@Cutlass2436
@Cutlass2436 Жыл бұрын
Can you do a video on how to make the player face something?
@kenalpha3
@kenalpha3 Жыл бұрын
4:23 reverse the yellow pin connections: so that Target is the branch with [Actor to face to], and the Start is the Player (use Self [for the Get Actor Location node] if the code is in the Player's BP, otherwise get a reference to Player). Then at the RInterp node (Get Actor Rotation), you also need that to reference the Player (so the node rotates the Player, not another Actor).
@Cutlass2436
@Cutlass2436 Жыл бұрын
@@kenalpha3 thank you!
@ZombieGuyDevelopment
@ZombieGuyDevelopment 10 ай бұрын
@@kenalpha3 doesn't work
@kenalpha3
@kenalpha3 10 ай бұрын
@@ZombieGuyDevelopment which part? Be specific, I said many things.
@M0nitor242
@M0nitor242 Жыл бұрын
me before watching: *IT KNOWS YOUR EVERY MOVE.* me after watching: r e a l i s t i c a s h e c k
@random-gz6eu
@random-gz6eu Жыл бұрын
i dont have mony and i want udemy cours for free what can i do
@kenalpha3
@kenalpha3 Жыл бұрын
Can you unblock my comments and add me to a safe list? It is annoying that YT is auto censoring me merely because I read the comments, and reply to help others. Then I post my own question. And the dumb code flags me as a spammer or whatever. Wastes my time when I type something and it doesnt get seen. Then for every video, I have to open a private tab to see if my comment is seen or not. So please add me to a safe list!! I help your viewers when I can.
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН
A teacher captured the cutest moment at the nursery #shorts
00:33
Fabiosa Stories
Рет қаралды 56 МЛН
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
MrBeast
Рет қаралды 111 МЛН
小宇宙竟然尿裤子!#小丑#家庭#搞笑
00:26
家庭搞笑日记
Рет қаралды 16 МЛН
How I Remade MW2 with Unreal Engine 5
12:37
reubs
Рет қаралды 3 МЛН
How to Make the NPC's Head Look At the Player in Unreal Engine 5
4:54
TRANSFORM To Different CHARACTER In Unreal Engine!
4:32
DevEdge • Abhay
Рет қаралды 11 М.
How To Make The AI Head Follow The Player | Unreal Engine Tutorial
12:07
AI Sight Detection And Chase - Unreal Engine 5 Tutorial
7:33
Matt Aspland
Рет қаралды 54 М.
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 102 М.
Why I'm ADDICTED To Filmmaking In Unreal Engine
8:02
Joshua M Kerr
Рет қаралды 347 М.
10 Unreal Engine 5 PLUGINS I can't live without!
9:37
Cinecom.net
Рет қаралды 504 М.
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН