I’m trying to create a HITMAN like object selection system in third person. So far I set up blueprints for items I want to interact with that include a trigger to detect when the player is close enough. When that happens, a little “pip” shows up that will show the user it’s interactable. My plan next is to hover over the object’s mesh with an invisible crosshair, from then a ui hint would appear to show the user how to interact. Currently, I can only get this to work with the mouse cursor, and not a point in screenspace. I’d like the interaction hint to show when I hover over the mesh, and disappear once I move off.
I originally tried to set my mouse position every tick while inside that trigger and hide the cursor on mouse hover events within the interactable object, but I get very ugly flickering. Here is my interactable blueprints :
This bit quite confusing - especially the invisible crosshair part. I still don’t understand whether we want to do it with the mouse or not.
we fetch all interactive object in proximity, makes sense
all show a blip icon
what now - how do we select one?
– we want show a prompt, for sure - ‘press E to Interact’ but how:
— by moving the cursor with the mouse (that’d be strangely difficult with an invisible cursor!)
— or by looking at it, pointing the camera at it
I wanted to potentially utilize the onmousehoverbegin and end to highlight and select objects since it’s convenient and I wanted to avoid doing a line trace every tick since everywhere I read says to not use tick at all. My backwards way of using the mouse cursor was to force it to the middle of the screen every frame to “act” as a line trace.
good point! I’m new to blueprints, coming from Unity it’s quite the change but i’m grasping it quite quickly.
the “hack” works perfectly well except for endoverlap events, it flickers on and off, so i’m assuming setting the mouse position every frame triggers a slew of overlap events. I’ll give linetrace another go and report back!
You could try add a retriggerable delay node with > 1 second duration after Decide Which to Show node in the overlap event that executes the Hide Me node when time runs out and delete the on End Cursos Over event. You’ll need this if you are going to use trace anyways.
Do tell how it goes. This can be set up with very little ticking, actually. You could even line trace just a couple of times per second, and the player wouldn’t notice. But this particular ticking is something I wouldn’t worry about.
You could add a capsule collision component that extends from the camera out to a specified distance. Have it only overlap your interactable actors. As long as it is overlapping it will display your message. On end overlap it disables.
This relies on you being close enough and centering focus (crosshair/center screen).
I have a widget that appears in screen space that shows up whenever the player actor overlaps a trigger on the item. Inside the widget is some code that takes in a variable for whichever action I have assigned to “interact” and decides to show either a pc or gamepad input.
using a custom trace channel - everything blocks it (so we can’t look at things behind obstacles) but the player ignores it (so we can trace through their capsule). More flexible somewhere further down the line than mere Ignore Self [T]
inheritance + Interface shines: everything can be LookedAt and Prodded, but only the pyramid can be equipped. A natural system for the generic Press E to Use - what use means depends on the actor with the function implementation which can feed data back to the player.
what’s your approach to the text?
Noticed something uncanny, eh? It’s a Widget Component in Screen Space but the gimmick is that it’s attached with a Springarm with Absolute Rotation.
Reasoning : it makes it trivial to offset in Z (even when things tumble around) and a bit of interpolation the camera lag produces makes the text easier to read when the owning actor is on the move. Feels really easy for the (my) eyes to track. If I were serious about this, I’d probably just place the component at the end of a local vector rather than use the expensive springarm - but it’s more fun this way.
It also makes any sudden changes of velocity appear more impactful as there is now a better point of reference. It might as well be a love / hate thing tbh, or utterly useless - depends on the purpose. Not sure whether it’s of any use for serious stuff. Definitely gives off a whimsical-cartoony vibe.