Download

Third person crosshair object highlight troubles

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 :

It does work properly when the mouse cursor is visible, any ideas? Thanks!

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

My apologies if it’s confusing!

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

Meh. People demonize Tick because folks tend to place things there that do not belong. If you want to see an update every frame, you Tick it. Or you have it ticked behind the scenes by something else.

Line Tracing to figure out where the character is looking does belong in Tick, imho. And I hereby challenge anyone who disagrees to a pillow fight.

There, I said.


See - you’re even doing things every frame here - which I’m almost sure is more computentially demanding than line tracing. I gotta say, this is actually an interesting hack…

1 Like

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!

1 Like

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.

1 Like

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.


@ConvenientBox How close is this to what you’re trying to accomplish?

1 Like

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

1 Like

@Everynone This is EXACTLY what i’m trying to accomplish! I’ve managed to get it working like in your example, but i’m having trouble hiding the prompt when the line trace stops hitting the item.

Below is how I had it working, but with the mouse cursor active. Basically the forcing of the mouse cursor to the center of the screen acted like a sudo line trace.

This is method I tried but failed, though truthfully I was so tripped up on my original attempt not working that I gave up. I’ll definitely give it another go. thanks!

what’s your approach to the text?

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.

The communication in the example revolves around Inheritance + Interface - a potent combo, imho.

  • the base class implements the interface (which children inherit)
  • the widget uses the same interface - calls children receive can be propagated: Actor → Widget Component → Widget without casting or finding user widgets (this can be done in many ways, though)

  • the player has a collision sphere and sends an interface call to overlapped actors as we approach:

image

image

Above, handling in the target shows / hides its widget component.


  • the Look At - when the trace hits the actor, the message is propagated to its Widget Component’s widget:

image

Above, the widget updates its look after receiving a propagated interface message.


In short:

  • proximity shows / hides the entire Widget Component
  • tracing an actor affects how the underlaying 2d widget looks

The logic is set up in such a way that it does not Tick the whole thing, it sends a single message when needed:

This can be optimised further, ofc - Gate tracing to execute only if there is something in Proximity.

Project link: interactiveProximity.zip - Google Drive


Other notes:

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

3 Likes

I’m honestly beyond words with this post, thank you so much for the explanation and file!!!

I’m currently going through it!