How To Create An Interact Dot Crosshair - Unreal Engine 4/5 Tutorial

Поділитися
Вставка
  • Опубліковано 27 лис 2024

КОМЕНТАРІ • 99

  • @SpiffyCS
    @SpiffyCS 2 роки тому +32

    Some tips for UMG you may not know:
    - In the Canvas Panel Slot, Ctrl+Shift clicking an anchor sets the Position and Alignment properties automatically, saving you the hassle of setting the Position to 0 or whatever every time.
    - The Alignment setting is used in the Canvas Slot to essentially change the pivot point of the component in the Canvas. It's a range from 0 - 1, so 0.5 x 0.5 is what it should be instead of setting the Position of the dot to -10 x -10. The Position can stay as 0 x 0 if the Alignment is set correctly (if you Ctrl+Shift click the centre anchor, you'll notice UE4+5 does the Position and Alignment for you, setting Position to 0 x 0, and Alignment to 0.5 x 0.5).
    - An Overlay can be used instead of a Canvas Panel to make simple stuff like this a lot easier, as it uses the Brush Image Size to determine child Images' sizes (Which saves using a Size Box for it). This obviously helps with resizing the Image to 20 x 20 in a Canvas Panel, and also makes centring something like a dot image trivial because of the Alignment enumerators. Not to mention Canvas Panels are a lot more computationally intensive than Overlays. Using a Canvas Panel in every widget you make will really slow a game down.
    Great video, just wanted to spread some helpful tips to anyone unknowing!

  • @Athasin
    @Athasin Рік тому +10

    Great video and you're right about not using Event Tick if you don't have to, which in this case you don't. For anyone interested, everything Matt did after event tick can be done in a function. Then in event begin play, right after setting the InteractDot reference variable drag off and search for "Set Timer By Function Name." For the function name put the name of the function you made with the linetrace, for the time set 0.1 or more (I personally prefer 0.2 but you can put it higher for less traces and better performance) and set looping to true.
    Just like that, Matt's tutorial works without using Event Tick.

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

      the only downside with this method is that there can be lag with when the indicator shows up. For instance if I set it to 0.2s timer (or delay loop) then put my mouse over it, it could be anywhere from 0 seconds to 0.2 seconds for the dot to show up. It would be far more obvious with higher values, but is a tradeoff to think about, and if it matters to you

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

      I implemented this and it seems to work swimmingly. Thank you for suggesting an option!

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

      @@coyohti Glad to hear it! I love using looping Set Timer By Function Name nodes instead of Event Ticks for stuff like this because you have so much more control over it:
      - Because the function tied to the node you can delay when a player actually gets an interaction dot after they spawn by just moving the node to an on begin overlap event.
      - There's a "Pause Timer by Function Name" and "Unpause Timer By Function Name" so you can decide when you want the function to be active without invalidating or clearing the timer.

  • @CotoFury
    @CotoFury 5 місяців тому +1

    Nice tutorial.
    If someone wants to improve this, instead of using Event tick, u can create a Custom event, and trigger that event in the camera input, so it only will execute when u move the mouse.

    • @Migler1
      @Migler1 4 місяці тому +3

      That would mean that if you don't move your mouse and move backwards the UI won't update since the mouse didn't move.

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

    A much more performant option is to simply create a thin box collision in front of the camera, stretched to the distance you want the interaction to occur at, and set it's collision to a new custom collision channel (name it "interaction"). Make the collision channel only overlap with the objects it can interact with (e.g. a door).
    Now whenever an object gets in front of you, you can do the rest of the function (show widget etc). This way you save the performance you would lose by firing a linetrace & checking against visibility every tick - which is completly unnecessary since a player won't interact with an object 60 - 140+ times every second.

    • @user-ll3uj1jz4s
      @user-ll3uj1jz4s 2 роки тому

      Collisions generally aren't more performant than linetraces, especially box collisions. Even if they were this would still be an unnecessary micro-optimization. Unreal can handle a surprising amount of linetraces per frame before incurring any noticeable performance cost. If you had so many traces going that you were starting to get slowdowns then another collider is just going to exacerbate the issue. You could do something like having rendered interactable objects check distance to the player. They could fire an event that turns the line trace on when the player is in range and another event that turns the line trace off when the player leaves range. But honestly, if you're doing that many linetraces in one frame the first thing you might want to look at is whether or not you're doing too many linetraces.

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

      Are you sure your method is more performant? I'm currently choosing between a trace and a narrow interaction shape. An issue with your method is that there could be a wall between the player and the object but the collision box would still interact with the object, whereas the trace method would be blocked by the wall.

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

    Not gonna lie, I’m so glad I found this video lol as this is one of the ONLY things I liked about Unity that Unreal didn’t seem to be able to do… but from your video, I was wrong lol. I’ve tried tutorials about interaction but every single one was about using trigger volume or using the line trace when hitting E… but I’m glad this one is doing what Unity is soooo easier at doing lol so thank you!!

  • @ЕгорКлимов-с6ч
    @ЕгорКлимов-с6ч 2 роки тому

    Best unreal engine tutorials I've seen

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

    You are the best, Matt! Thank you again for all of your amazing tutorials!

  • @blenderahoi-jb5ol
    @blenderahoi-jb5ol Місяць тому

    Thank you very much. Very helpfull, even 2 Years later!

  • @1d33f1x3
    @1d33f1x3 2 роки тому

    Such an easy implementation, thank you! Using interfaces is smart, I always seem to forget to use those.

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

    B + left click for branch, nice shortcut. Thanks for nice tutorial as usual

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

    I literally just was about to search up a tutorial for this and this one was just made and its perfect😂

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

    such a great tutorial - I played around with this today and made it change from a small dot to a larger dot when hovering over an interactable item instead - thanks heaps!

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

    amazing tutorial

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

    This is great! Thanks!
    Could you make a video on camera shake and how to do a good, first person walk camera shake and sprint camera shake? I know it's subjective, but I'm struggling to keep the shake noticeable, but subtle at the same time.

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

    Thank you so much! I was trying to do something like this for days.

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

    YOU HAVE NO IDEA HOW BAD I NEEDED THIS

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

    Hey Matt, nice video. Just a quick question can this be used this the same way for the cursor to highlight the outline of the interactable object?

    • @MattAspland
      @MattAspland  2 роки тому +6

      In a similar way yes. It will all work the same, but you'll need to slightly modify where the linetrace comes from. You'll need to go from the mouse cursor location, instead of the camera location. I can add this to my list if you want?

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

      @@MattAspland That would b great if you could, cheers.

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

      @@MattAspland +1. Using the Mouse cursor location would let us also use it for 2.5D SideScroller. So if you could make a quick part 2 that just shows the code addon for that :) And you can tell us watch part 1 for the initial setup.

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

    Awesome tutorial!😍

  • @Brycicle3d
    @Brycicle3d 3 місяці тому

    Leaving a comment for anyone else who had this issue, if it takes a second to register the crosshair the event tick interval might be set to be a bigger number than what you want by default. (Click the class defaults to change tick interval)

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

    you can optimize this with setting the tickrate to sth lower than every frame per second in the Class defaults

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

    Thanks Matt, great tutorial 👍

  • @zlatty88
    @zlatty88 8 місяців тому +1

    I can't get this to work for the life of me. I've tried this and other tutorials which have the same layout basically and no reticle....

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

    Thanks dude . you're awesome

  • @SchnitzelMickey
    @SchnitzelMickey 7 місяців тому

    Hey man Great Video, is it possible to have the dot change color/size when clicking on the interacted object? So basically when you hover over the object the dot shows up and then when you click the object you get a color/size feedback from the dot.
    Thanks man

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

    Could you do a tutorial on a simple train system? As in, an actor travels along a spline in a circle, however comes to a temporary stop at the 12oclock and 6oclock points on the circle :)

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

      I can add that onto my list :)

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

    An alternative to using Event Tick on player characters, at least from what I've found, is to have it run whenever a look input is fired. So instead of running every frame, it only runs when your view changes. About the only problem I could see is a moving object when your view is still, but humans tend to try and focus on moving objects anyway.

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

      Yep I've done this before and come across the same problem you mentioned. It is definitely more efficient to only do it when the player moves or moves their mouse. However, if they are pushed or an object moves it won't update. So you could possibly also have it fire off every few seconds on top of whenever they move to counter that.

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

      @@MattAspland Question about UE4.27 and "So instead of running every frame"
      Does Event tick still have the problem where if you are set to 90 fps (or your computer can run that fast), that the Event ticks 90 frames, vs 30 fps ticks 30 frames?
      Can we normalize the tick to not do extreme values and only update 30 fps (for all users - even if they set their game/computer to 90 fps)?
      Thats the bad thing I heard about Event tick - but might have been for a version before 4.27. So I ask.

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

      @@kenalpha3 I think there is actually a way to lock the tickrate to a certain value on a per-actor basis, as well as methods to disable/re-enable tick.

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

      @@slingshotdev "a way to lock the tickrate" TY.
      I heard of this, but forgot how; and wanted someone to say if it's a working alternative (counter to the con of Tick).

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

    Great tutorial!

  • @GabrielDosComentários
    @GabrielDosComentários 3 місяці тому +1

    To PERFECT POSITON do it:
    Anchor: Center
    Position X: 0
    Position Y: 0
    Alignment: 0,5 and 0,5

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

    you're awesome thank you

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

    Hey, it worked for me but i've got a problem.
    When i'll try to add Event Interact on my blueprint, link to Print string, it didn't work, why ?

  • @FiresAndFoxes
    @FiresAndFoxes 7 місяців тому +2

    Its not working on character meshes? Any help?

    • @Alish1388-hi
      @Alish1388-hi 5 місяців тому

      Hi, did you add a box collusion?

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

    that was very useful

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

    Hello, thanks for this awesome tutorial. I'm trying to do the same for vr. But it doesn't seem to work

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

    Hey Matt! Really enjoying your tutorials! Could you make a tutorial on how to make a beeping detector? Similar to the one from Alien Isolation.

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

    I wanted a "look at and pickup" mechanic for my game. The collision overlap does not offer the preciseness I want, while the linetrace ends up firing perpetually. Is it not possible to create an event overlap function on the objects, prompting the linetrace to start and stop on the player entering and leaving the objects collision? The linetrace would still constantly fire, but only when the player is actually overlapping with an object, giving the functionality of being able to add a prompt on viewing something, without the game constantly using the linetrace.

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

    For some reason, when I package my project… my highlight UI isn’t showing up. But when I look back into the editor, it shows up completely fine. Any other UI shows up when packaged except the highlighting one… it doesn’t make any sense
    Edit: fixed now. The problem was using the “Is Valid” node that was hindering the UI to appear for some reason. So I removed that and it’s fine now!

  • @50meters20000tons
    @50meters20000tons 2 роки тому

    Hi Matt, thank you for your time on these, I appreciate you very much. You note that this works best for first person. I agree but is it possible to have the option to use it on a player character than can toggle between 1st and 3rd person cameras? I thought I could just add another pin to my Sequence (the one right after event tick), use "Then 2" and connect it to a copy paste of the code from this videos tutorial (I switched out the target from first person camera to third) but that doesnt work (only recognizes the code for 1st person interact dot). I used a flip/flop after Sequence which sort of works but it is glitchy ( isnt precise and the crosshair blinks on and off when its near an object in 3rd person). Do you have any suggestions?

    • @50meters20000tons
      @50meters20000tons 2 роки тому

      FIXED: so what I was trying to accomplish was to have a small crosshair dot always on screen. But an additional crosshair would show up when interacting with an object as in your tutorial. In both 1st and 3rd person. I have it working as intended now using sequence. The reason it wasnt working before was related to other linetraces I had firing off in the background. I also included an "is active" to check for specific cameras.

  • @joshhicks7205
    @joshhicks7205 10 днів тому

    What if the actor has certain components you don’t want interact with but others that you do

  • @Rhyper-
    @Rhyper- Рік тому

    Hey Matt thank you for the video! I have a question though, if I wanted to use this for multiplayer and everyone uses the same character one person causes everyone's screen to have the dot drawn while they aren't near the object. How would I fix it so this doesn't happen?

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

    Hi, Matt! I don't know if you will get my comment, since your video is a already couple of month old, besides you might have many other comments to look through, but I will try my luck. Would you please help me with this issue - how should I change this code in a way, that when player is looking at the intractable object, not only dot appears on viewport, but also the object in question changes, say starts to glow, or glowing outline appears, or color of object changes? This way it brings more attention to the player, that this particular object is intractable.
    Thanks!
    And all you videos are great. I learn a lot from them!
    BR,
    Valters.

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

    I have a system like this set up and it works great, but I'm trying to figure out how to select different widgets to show by the line trace. Anybody know how this is done? Ex. A door blueprint that displays a lock widget when looking at the lock, and a door open widget when looking at the door.

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

    How to make combo for flip book charecter?

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

    why you added collision box? not using it in this video anyway :/

  • @CraigDodgens-n2g
    @CraigDodgens-n2g Рік тому +1

    i followed step by step but it doesnt work has UE5.3 made changes where this doesnt work?

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

      I fixed it for myself by putting a sequence after tick. Then put a validation get (or a do once) infront of create widget. Then the rest of the sequence handles the add to view and remove from parent as the rest of the video has implimented.
      This is another reason to NOT use event tick for anything other than testing and to use delays set to an imperceptible number. This was basically creating the widget and setting the variable over and over in an infinite loop.

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

    Hi! I have an issue where the crosshair gets stuck on screen after I add an item to my inventory and call the destroy actor node. The crosshair stays on screen until I look at something else that can enable/disable it. I've tried adding a remove from parent node to the interactable object I picked up, but so far that hasn't worked for me.

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

    Hey Matt. I'm making a horror game and the map is decently dark and I've noticed that the character's camera fades-in in a dark environment after looking away from something bright, and it kind of looks like the character's eyes are getting used to the darkness. Is there any camera parameter that changes this so that it doesn't do that? It's quite annoying and you've probably also seen it before.

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

      Add post process volume, check the box for infinite extend (unbound) and then type in the search bar "exposure" and set the min and max values to 1

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

      What he said (and there might be another setting, I forgot, but heard of this). And Epic has auto light adjust. So thats why it's doing it.

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

      Thanks guys. I'll try the solution of Gaming Plus and I'll also research what Kenalpha said.

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

    I wonder what the node setup would look like to constrain the linetrace to a certain distance? So the player needs to be close to trigger the dot. Maybe simply modify the linetrace setup, or something with the interface node/box collision?

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

      In fact, the linetrace is already constrained to 500cm in this setup.

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

      This video allows for the linetrace to be a certain length. You can modify the value in the "Vector*Float" to change it's length

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

      @@MattAspland oh, that's cool, I didn't notice that 😁

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

    Hello I'm trying to do a simple if you click on object spawn it sends you to a widget that you can select different objects to pick from my problem is that I will have multiple spawners and it only puts the item on the first one could you tell me how to go about doing this?

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

    mine doesnt show up until i interact with any interactable object for the first time it then will show and hide as it should so i need something some where to have it be "on" from the get go

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

    I'm not sure if you take requests from the comments section or not but I was wondering if you would be willing take a look at how to make a 'hit flash' effect i.e. the enemy briefly flashes a certain colour when hit by the player character in order to communicate to the player that their attack is working.

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

      Great idea Travis, I can add it onto my list!

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

      Ive seen this effect a lot in vids/market assets. If anyone can answer so I get an idea how it works, or to know what to search for: Does it make a copy of the body mesh, and animate (apply) the hit Material on that mesh?
      Or does it transition the hit Material on the original body mesh?
      But then how does it work when the character mesh (BP) is a collection of overlapping meshes (modular - set to use the same skeletal animation)?
      Ive see a tut where touching a Trigger turns the Character mesh into gold (Material). And it has code to get a copy of each mesh in the Char BP > change it to the gold Material. But for hit effects (that are temporary), im wondering how that would look - and how to make the hit (decal?) only apply to the body area that got hit.
      Ive also seen a tut for making a modded gun that "draws" slim damage on only the character body where hit.
      But I couldnt finish that tut for 2.5D SideScroller because he didnt tell the linetrace hit code for a line from the [2D view] character - to the mouse cursor/enemy, along the X axis only.
      (Thats a problem with a lot of FirstP and ThirdP tutorials. They dont give the hit code for 2.5D SideScroller. And I searched, and no one has taught the basic firing code for the 2.5D plane. And Epic didnt give us an example???)

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

    GG vidéo

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

    How to make unreal engine 5 player kill message make video🧐🧐🧐😥

  • @v-tr7vg
    @v-tr7vg 5 місяців тому

    create a video on click event when you hover on any object its shows interact and when you click its give you option to select.. hope you understand this type of video is not available on youtube.

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

    Theres already a first person character in unreal. Why did you remake it?

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

    🙏🏿

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

    i dont have the remove from parent

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

  • @Gamer-qn2oh
    @Gamer-qn2oh Рік тому

    Can you make a tutorial on this thing where the crosshair will be always there and will interact when its pointed towards the object plzzzzzzzzzzzz 🥲🥲🥲

  • @TheSnoozer-23
    @TheSnoozer-23 Місяць тому

    It didn't work for me

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

    Not working. Remove from parent doesn't seem to be doing as expected.
    ***EDIT***
    Fixed by putting a sequence after tick. Then put a validation get (or a do once) infront of create widget. Then the rest of the sequence handles the add to view and remove from parent as the rest of the video has implimented.
    This is another reason to NOT use event tick for anythign other than testing and to use delays set to an imperceptible number. This was basically creating the widget and setting the variable in an infinite loop.

    • @WilBuildIt
      @WilBuildIt 6 місяців тому +1

      Hey, just wanted to say thank you so much. This was my first ever tutorial I was following in UE, I was pretty bummed when it didn't work. I read your comment, followed your clear instructions, and it works great. You're awesome. Hope you have a WONDERFUL life.

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

      @@WilBuildIt Glad it helpd!

  • @mr.generalx
    @mr.generalx 2 роки тому

    How To Make A 8bit Mini Game Like Fnaf Mini Games

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

    It is not working for me.

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

    We want to see your nice face in video when talking

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

    Matt, there is some difference between (get camera world rotation⊶get forward vector) or getting the forward vector directly from the camera as u did in this tut?

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

      Hey Carlos, there's no difference in those two nope. The forward vector should be the same regardless