How to Make a Enemy Target Lock System in Unreal Engine 5

Поділитися
Вставка
  • Опубліковано 12 січ 2025

КОМЕНТАРІ • 79

  • @Goobsnoot
    @Goobsnoot 2 роки тому +37

    This guy has helped me with my entire video games career. I used to be stuck on everything He helps with such obvious stuff that nobody would make tutorials on and also some stuff I would never think on implementing into my game but it fits perfectly. there is rarely any “actually..” in his videos

    • @GorkaGames
      @GorkaGames  2 роки тому +4

      Thank you so much!! I love to hear that! I`m glad that I could help you in your game dev journey, I always try to make my tutorials straight to the point and, on subjects that are complicated, and turn them into a easy video to follow😄

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

      That_Is_So_True🔺

  • @maxlikessnacks123
    @maxlikessnacks123 2 роки тому +22

    "What's up guys? Welcome to new Unreal Engine Fuck Tutorial!" 💀

    • @KegaB3
      @KegaB3 4 місяці тому

      thats how you know its good

  • @SuperJohnsmith
    @SuperJohnsmith 9 місяців тому

    This is a good starting point and helped me plan out a more robust system, thanks for sharing!
    To anybody watching this in the future, be wary that this system does not exclude a few features that are required for a good lock on system such as:
    - Excluding targets hidden behind walls or who are already dead.
    - Swap to next target (left or right based on input)
    - Once locked on, the target can move out of range, so you will need a way for it to unlock from targets that exit a distance threshold. (Also for when they die)
    - A tether point or some kind of camera smoothing so it doesn't follow the player exactly. (You'll find this in games like Dark Souls)

    • @brandonsharp2460
      @brandonsharp2460 4 місяці тому

      Just Use Tags on the light trace, from the option "Actors to Ignore"

    • @bluewolfofl7424
      @bluewolfofl7424 2 місяці тому

      I was gonna say, "yeah but you can tweak it a bit and find other tutorials to fix those as they seem like minor issues" but you did say it's a good starting point which is true.

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

    2:04
    Follow Camera -> Get World Rotation -> Get forward Vector

  • @zachwise476
    @zachwise476 Рік тому +7

    So helpful! With the Game Art degree I achieved at Full Sail University and the directions within your videos I will be able to accomplish creating at least one AAA level game.

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

    That hair looks great on you and it has physics. Awesome Video

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

      Yeah 🤣 I love how the hair turned out. Thanks!

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

      @@GorkaGames Was the physics applied on the hair tutorial you made as well?

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

      @@AliBounds Yes!!

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

    If you make a target lock, make it at the target's head only at CQB distances or long distances for a sniper. Otherwise, the target lock should be on the sternum / solar plexus (called "center of mass"), because that is how most soldiers are trained and how most people aim instinctively. The Rainbow Six series suffers from AI that aims for the head at any distance.

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

      yeah absolutely. The target lock should aim at the enemy's head, and right now it aims at the actor's pivot. But for this tutorial I was just showing how to make a simple targeting system, without going in so much detail, just focusing on the core of its systems. But if you were to add this into an accurate/ tactical game like Rainbow, I would agree.

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

      @@GorkaGames Yeah, but I mean that Rainbow Six games rely too heavily on targeting the head. It isn't realistic. For example, Larry Vickers when he was in Delta Force still aims "center of mass" when it is necessary to guarantee a hit.

  • @DevilFruitJourney
    @DevilFruitJourney 11 місяців тому

    We need an updated video about combing this with strafe movements :)

  • @yokoshi1
    @yokoshi1 11 місяців тому +2

    Lol funny thing is, the boolean you said we didn't need, I actually do need it since I made a magic system and I only want the magic to hit the targeted pawn thus the boolean was needed for me to make it only occur if that bool is true~ Very very helpful

  • @atomicshrimpFT
    @atomicshrimpFT 2 роки тому +3

    Hi, usually you explain everything you create, but this time I felt like you needed to explain what you did at event tick. I’m still trying to grasp the concept of player controller and controll rotations. Could you proviedr a quick explanation maybe? Would be very helpful ❤️

    • @GorkaGames
      @GorkaGames  2 роки тому +3

      Hi, yeah of course, sorry if I might have left something there to explain. So the controller is a non-physical actor that basically possesses the player (in other words, what controls the player ). So I can access its rotation, and therefore change the whole player`s rotation with a new one very easily. So then I can find the direction between the player, and the targeted enemy, with that handy "Find look at rotation" node. Hope this helps and thanks for the support!! ❤

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

      @@GorkaGames Ok, but why doesn’t the player rotet towards the target then? Or is it because we only rotate the camera?

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

      @@atomicshrimpFT this is because we are not overriding the other controller settings. As the the Y- yaw control

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

      @@GorkaGames Set controll rotation doesn’t override the controler? That’s new to me. I guess I’ll just come back to it when I need it😂

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

      @@atomicshrimpFT yeah 🤣 something’s are just confusing but it’s how they work. So the camera boom is basically not being overrided by the controller

  • @Jordo95
    @Jordo95 9 місяців тому

    you are a god send, my friend. Always so thorough in your teachings.

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

    Awesome cheers for this :-)

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

    Nice one bud ty

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

    love the video! but how can I make it so it locks gradually and not teleport??

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

    awsome tut!!
    couldn't find one on changing target lock? did u make that one too?

  • @Zacharadus
    @Zacharadus 8 місяців тому

    Hey everyone, an unreal newbie here! Quick question, I've been wanting to implement strafing in my target lock system, if I left the Target Lock variable in and made it public, would I be able to use that to switch between animation sets? Thanks in advance, and thanks for teaching me so much Gorka Games!

  • @SuperBatAnimations
    @SuperBatAnimations 8 місяців тому

    Is it possible to do an auto lock on when you approach an enemy at a certain distance?

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

    Great tutorial as ever! If we want to switch between different targets moving the mouse or controller stick is it possible to implement? I cannot find any tutorial about that, thansk!

  • @svrvphimprod
    @svrvphimprod 10 місяців тому +1

    What do you mean by "break it"? I don't have good internet and can't see the name of the node
    Edit: I figured out that it was "break hit result" but it will not let me plug the out hit into it...

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

    Nice this is added to the list of thing to be added to the game

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

    I have a question. As much as I can think, the lock will still work if the opponent is behind a wall. How to avoid that and also suppose there are multiple pawn in front of you it can decide which one to focus on depending on who got hit first but what if I want to switch between those players? I want something like in sekiro where if I try to move my mouse in focus it snaps to the next nearest enemy.

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

    cool i like how you kept your hair

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

      thanks! yeah I love it 😄

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

    Get forward vector -> multiple splits into 3x for XYZ

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

      ah needed to right click to convert to a single float

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

    How do you apply this for example you want to target specific parts of an enemy like in 0Onster Hunter games where you break specific body parts?

  • @theoneoverseeraotoariseoft6549

    6:43 Snap back to reality

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

    Hey, this was really helpful but I was just wondering if there was a way to get the targeted enemy location?

  • @fatiherolmuhendislik
    @fatiherolmuhendislik 11 місяців тому

    Thanks a lot ! Very helpful tutorial.

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

    Can this work for first person cameras?

  • @traviszombeck7379
    @traviszombeck7379 10 місяців тому

    but what if i want to do 8 directional movement while locked on? how do i keep my character facing the enemy

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

    Thank you for the good video, but I'd like to give you a hint: the boolean you created in the first part of the video was the best way to optimize the logic. In the tick event, you should have made a check on that boolean instead of checking the validity of the pawn, because that's a lighter method for the compiler. However, the video is very clear, well explained and goes straight to the point, so thank you very much!

  • @synystyr6
    @synystyr6 9 місяців тому

    After testing it. I’ve got a Message log saying Blueprints Runtime Error. But everything runs smooth🤷🏻‍♂️

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

    Hi! How can I make a target lock for a first person? I tried this way, but it only makes my player look at the location of the target, but not towards the object (for example, if its a little chair, it looks to the direction of the chair, but not the object). I hope you understand my problem, or if you could give me some advice here. Thank you! Love your channel

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

    Nice video, I am trying to set it up so that when I kill the enemy, the camera returns to normal. The issue I am getting is that when the enemy dies, the camera always seems to take on the world location value and always turns my character to the same point (world location 0,0,0). Any way of fixing this?

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

      Have you tried creating a boolean check in your camera lock blueprint to check if the HitTarget actor has a particular flag for alive or dead, then check a boolean if the target is alive or dead. If dead, break the target lock. If alive, keep the lock. Hope that helps!

  • @KS-lf9wu
    @KS-lf9wu 8 місяців тому

    Is anyone know a auto lock on for a top down I try to find everywhere only for third person character and that's it like doesn't exist pls i really need help

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

    The fact that this is so simple is infuriating.

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

    but if you miss you have to double tap the lock on key to then lock on because of the flip flip being on B, is there any fix or work around to this?

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

      this is probably quite late, but this is where you want to use a Boolean with a branch instead of a FlipFlop.
      and only if the conditions are meet for target locking e.g. (HitResult = true and any other checks to confirm its an enemy ect.) then you set the bool to true.

    • @brandonsharp2460
      @brandonsharp2460 4 місяці тому

      You can also just increase the radius of the trace, so the chance of missing is very sparce.

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

    This works, but I'm having issues with other axes of the camera. If a target is higher or lower than the player, or if I get too close to the target, the camera goes above me, looking down and I can't move forward. The control rotation changes like a compass and causes the forward movement vector to change on the player. Any advice?

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

    1:49 my timestamp

  • @moodwalker4149
    @moodwalker4149 8 днів тому

    I'm able to get the line trace but for some reason it's not able to lock. please help!

    • @moodwalker4149
      @moodwalker4149 День тому

      Ok I was able to do this, but only works with Enhanced input with Character Movement. Is there a tutorial for Floating Pawn Movement with Legacy Input?

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

    Next police system with stars like gta

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

      yeah good one! I actually have made it before for one of my games, I will see if I can make a tutorial about it

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

      @@GorkaGames yep there are not many tutorial about it

  • @EVAN-xu2os
    @EVAN-xu2os Рік тому

    Question how do I remove the sphere trace or make it invisible?

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

      On the Sphere Trace for Objects node, set the Draw Debug Type option to "None"

  • @Messenger-1221
    @Messenger-1221 Рік тому

    there is bug that stops the pawn from receiving damage

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

    This doesn't work for long distance. I am trying to do it for an aircraft spotting people on the ground. Also doesn't work if there are mulitple enemies..... SO basically serves no purpose I don't know a game that only has one enemy character.

  • @Zingo_Dan
    @Zingo_Dan 5 місяців тому

    Not gonna lie o think I'm just Dumb because it's so simple it just his pace is fast and I don't even notice the detail I think I'm turning into sleepy joe😅

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

    Thanks for the video. Can you make a video for throwing something and recalling it fly back to the hand? I think it super similar to this tutOrial. Thanks

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

      Yeah, do you mean like in God Of War with he's axe?

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

      @@GorkaGames Yes, exactly, and maybe the force in star war. Just simple toturials with the concepts. THanks.

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

    CAMT MOVE THE MOUSE ON TARGET LOCK

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

    Dark souls 🤔🤔🤔