# Third person crosshair object highlight troubles

**URL:** <https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [September 22, 2021, 4:11am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041 "2021-09-22T04:11:02Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![ConvenientBox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/convenientbox/32/88719_2.png) [@ConvenientBox](https://forums.unrealengine.com/u/ConvenientBox)\
**Post date:** [September 22, 2021, 4:11am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/1 "2021-09-22T04:11:02Z")

</div>

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 :

 ![Screenshot 2021-09-21 214042](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/a/ca784e4859a6e284e94bb3accec4e9844aa77791.png)

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 22, 2021, 7:23am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/2 "2021-09-22T07:23:46Z")

</div>

> [@ConvenientBox](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![ConvenientBox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/convenientbox/32/88719_2.png) [@ConvenientBox](https://forums.unrealengine.com/u/ConvenientBox)\
**Post date:** [September 22, 2021, 2:13pm UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/3 "2021-09-22T14:13:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 22, 2021, 2:22pm UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/4 "2021-09-22T14:22:56Z")

</div>

> [@ConvenientBox](#):
>
> I wanted to avoid doing a line trace every tick since everywhere I read says to not use tick at all

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.

* * *

> [@ConvenientBox](#):
>
> 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.

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…

---

<div class="post-metadata">

**Author:** ![ConvenientBox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/convenientbox/32/88719_2.png) [@ConvenientBox](https://forums.unrealengine.com/u/ConvenientBox)\
**Post date:** [September 22, 2021, 3:03pm UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/5 "2021-09-22T15:03:45Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [September 22, 2021, 3:42pm UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/6 "2021-09-22T15:42:56Z")

</div>

> [@ConvenientBox](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 22, 2021, 7:10pm UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/7 "2021-09-22T19:10:49Z")

</div>

> [@ConvenientBox](#):
>
> I’ll give linetrace another go and report back!

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?

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [September 22, 2021, 7:38pm UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/8 "2021-09-22T19:38:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ConvenientBox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/convenientbox/32/88719_2.png) [@ConvenientBox](https://forums.unrealengine.com/u/ConvenientBox)\
**Post date:** [September 23, 2021, 1:33am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/9 "2021-09-23T01:33:05Z")

</div>

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

[https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/d/9d000a108e53571616f103d53de70dbc030300dc.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/d/9d000a108e53571616f103d53de70dbc030300dc.mp4)

---

<div class="post-metadata">

**Author:** ![ConvenientBox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/convenientbox/32/88719_2.png) [@ConvenientBox](https://forums.unrealengine.com/u/ConvenientBox)\
**Post date:** [September 23, 2021, 1:38am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/10 "2021-09-23T01:38:44Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [September 23, 2021, 3:13am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/11 "2021-09-23T03:13:45Z")

</div>

what’s your approach to the text?

---

<div class="post-metadata">

**Author:** ![ConvenientBox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/convenientbox/32/88719_2.png) [@ConvenientBox](https://forums.unrealengine.com/u/ConvenientBox)\
**Post date:** [September 23, 2021, 4:00am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/12 "2021-09-23T04:00:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [September 23, 2021, 9:32am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/13 "2021-09-23T09:32:16Z")

</div>

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)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/0/f0362d5963af33e7b78be05afc45d7e51bb3b5a9.jpeg)

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

![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/a/3/a373d6fdf9ee0399095844f5c118b046f902c6da.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/2/6/26ac43203daf51a28961ab738028a9ee5db19011.png)

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](https://d3kjluh73b9h9o.cloudfront.net/original/3X/4/6/463f7dab59983f457acc85a5aecc0ed74fc29630.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/4/c4ece888dc7d11166e5502b31a82102185296615.jpeg)

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](https://drive.google.com/file/d/1uwAXFTyX5TkQ71cM5wTKAYdchrNEEHE6/view?usp=sharing)

* * *

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/9/f98f151c3b13dfba3412ec2e7ba0c442678d7b0b.png)

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.

---

<div class="post-metadata">

**Author:** ![ConvenientBox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/convenientbox/32/88719_2.png) [@ConvenientBox](https://forums.unrealengine.com/u/ConvenientBox)\
**Post date:** [September 24, 2021, 2:26am UTC](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/14 "2021-09-24T02:26:32Z")

</div>

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

I’m currently going through it!
