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

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ธ.ค. 2024

ความคิดเห็น • 35

  • @TheHairyDizz
    @TheHairyDizz 2 หลายเดือนก่อน

    Thanks again Matt! A lot of what you have been teaching me will be present in my game set for release on the 11th! Without your knowledge and willingness to share it so freely, I would have never been able to overcome these unique challenges. I'm forever grateful for you and thank you for enabling so much creativity in your community! You are seriously the best my man!

    • @MattAspland
      @MattAspland  2 หลายเดือนก่อน +1

      That’s amazing to hear!! ❤️

  • @Lifefire.
    @Lifefire. ปีที่แล้ว +5

    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).

  • @fl1nch_155
    @fl1nch_155 ปีที่แล้ว

    I was searching for this yesterday and didn’t find anything this is perfect timing!

  • @orccomputers2145
    @orccomputers2145 ปีที่แล้ว +1

    love your work

  • @silentgaming5610
    @silentgaming5610 5 หลายเดือนก่อน +1

    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!!

  • @MagmaProductionsYT
    @MagmaProductionsYT ปีที่แล้ว +3

    I WAS LITERALLY JUST NEEDING THIS! THANK YOU!

  • @regbagshaw423
    @regbagshaw423 11 หลายเดือนก่อน

    Hey Matt, always great tutorials man. Can you do a tutorial having a companion ai roam randomly within a certain distance of the player?

  • @demiplume
    @demiplume ปีที่แล้ว

    I made something similar to this, an actorComponent "RotateTowardActor" with defaults on player. It's useful because Text then is always visible.

  • @StudioPA
    @StudioPA ปีที่แล้ว +1

    help! how about the opposite of this? like your player camera will look at ai right on activating a trigger? how to do it?

  • @Steelersfan355
    @Steelersfan355 5 หลายเดือนก่อน

    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

  • @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."

  • @PatrickTheDM
    @PatrickTheDM ปีที่แล้ว

    I very well may add something with this before finalizing my Maze game. 👍

  • @pawpotsRS
    @pawpotsRS ปีที่แล้ว

    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?

  • @stealthgamesaremyjam145
    @stealthgamesaremyjam145 5 หลายเดือนก่อน

    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.

  • @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?

  • @fungusfinder
    @fungusfinder ปีที่แล้ว

    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.

  • @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?

  • @foolsanticsstudio
    @foolsanticsstudio 9 หลายเดือนก่อน

    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 5 หลายเดือนก่อน

      same problem here

  • @rifat.ahammed
    @rifat.ahammed ปีที่แล้ว

    Great. Thank YUU

  • @Cutlass2436
    @Cutlass2436 ปีที่แล้ว

    Can you do a video on how to make the player face something?

    • @kenalpha3
      @kenalpha3 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      @@kenalpha3 thank you!

    • @ZombieGuyDevelopment
      @ZombieGuyDevelopment ปีที่แล้ว

      @@kenalpha3 doesn't work

    • @kenalpha3
      @kenalpha3 ปีที่แล้ว

      @@ZombieGuyDevelopment which part? Be specific, I said many things.

  • @1994Persona
    @1994Persona 9 หลายเดือนก่อน

    Hello, i want to ask how is possible to make two playable characters to be attracted to each other

  • @M0nitor242
    @M0nitor242 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

    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.