Look at and show an image

Hi,

Please, can anyone tell me a way to make an image (widget) to show up in the corner when a character FP is looking up an object ?

Thanks,

First of all, let’s make it clear what you mean by “looking up an object”. Does it mean that the object is shown on the screen or is in the center of the screen (under the crosshair)?


Or “Looking up” means “searching for”? Please give a bit more detailed explanation.

eg: I have a box on a table so when I get close and look straight to the box and image or a text (widget) will pop up on my screen then when I looked away from the box the text will vanish…Does make sense now?

Thanks, :slight_smile:

Yep. Use Line Trace by Channel WTF Is? Line Trace By Channel Node in Unreal Engine 4 ( UE4 ) - YouTube

Thanks…I saw that video before but I thought it was a bit more complex no?

Please, could direct me a tutorial where I can do the Line trace on a object and showing a widget image on screen.
I have watched this one but its a bit different from what I am after …

Sure, I can show you some screenshots of how I would do that, but not right now, maybe in 6-7 hours.


I don’t think there’s an exact tutorial with traces and widget all-in-one. In a few words, you have to set a Line Trace, Break its Hit Results, and check if the Hit Actor is your Box or whatever. How exactly you check it may differ, I personally love Actor Tags, so I’d check if Actor Has Tag. If checking returns true, you get your widget and change the text in the corner to what you need (this text may be stored in the Box itself os that you can directly transfer it to the widget with no need to create additional text/string variables).


Here’s a Break Hit Results screenshot I’ve found on the internert, just for reference.




If you don’t find a way to achieve your goal, I’ll try to show you custom screenshots later.

Thank you Tuerer for you time!!..Well, that is when I get confused because I dont know how to connect the object …etc…
I am not a programmer…so its quite difficult to me. I am not in rush…if you can show me a bit step by step I will be very grateful. Thanks

I’m not a programmer either, that’s why I’m using blueprints =)


Have you already created HUD and a Widget? Start with that. Just place any picture in the corner of your screen to be seen at all times. Finding a HUD tutotrial won’t de a problem.

well maybe I am far behind :).Thanks for your help anyway…:slight_smile:

yes…I done :)…I have created a widget (called WidgetImage), then I clicked on the Open level blueprinted and done the this (image attached) and

its showing on the viewport …:). when I press play

what should I do now?

262120-capture.jpg

am I doing right…? is on the right direction ?

Here it is.

You have already set the image. Good.

The tracing looks like this:


I set a timer, but you can use Tick; I believe 10 times a second should be enough, hence time is 0.1.

Set Brush - is where you select your image. Make sure to right-click In Brush pin and Split it to see all of that.

I added the Set Visibility to turn a picture off when not facing the box, but you can do something else.

HUD and Widget and Image Box names will be different for you, of course, depending on how you named them. BTW, I save the HUD to a variable on Begin Play not to use Cast a lot.




Well I guess that’s it. Here’s the result:

262149-boxx.gif




Don’t hesitate to ask if anything is unclear. But please, do that in comments, not in new answers.

Oh, don’t forget to add a tag to your box, if you’ll be using Actor Has Tag.

Hey,…
wow…its perfect that what I want…!! I cant find anything on internet…looking for days…etc…

however, I was trying to do it but I get a bit lost i have started but I cant understand completed…
I will send scene where I was trying to do then please can you a look where I have stop…I’ve blueprinted on the fp character player…ok

link text

I just cant carry on from that :(…

Thanks a lot,

Sorry, but I won’t download that. You can show your screenshots here and maybe someone will help you. It’s not too hard, you just have to do some learning, and you can’t do that if someone’s doing your job for you.

oh…sorry, I didnt want to come across like this…
I’ve send you a simple scene where I was doing the widget…your blueprint…etc.just for you to check what I have missed and instead of screen grab as there is a point that I really don’t understand (its more about the languague as well) and .because you said you are doing in a different way using actor tag so I thought it will be hard to find somewhere to learn as I’ve have been looking for this for long time with different tutorials However,no one shows like you have done…I thought looking on the a scene it will be better to figure out and apply to my real scene project…

Anyway,I think I am going to have a look deeper and with calm …about
tags etc…and I might post a screen grab ask you a question in the future… :)…Thanks

Hi Tuere,
I am came up this weekend with this blueprint…its a bit different, but between you stuff and other things I’ve learned…etc… but the only thing that is missing is when the camera its not looking the box and makes the widget go away…Right now I have by time showing on the viewport, and its not that great…
Any idea ?

Thanks,

The Line Trace node has a Return Value output pin that shows if there’s a hit. Add a branch right after the Trace with that Return Value, and if it’s false, make your picture invisible or remove it.


And next you want to check if the hit object is your box (or another object that should be displayed in a picture), and if not, make a picture disappear as well.


Another thing: I’d suggest adding the widget to the viewport once (on Begin Play, for example), and then just change the picture in it, so you won’t have to create and destoy it every time.

Thanks, (sorry just was having time today to have a look)
I was trying but it’s not working …I am not sure why ?? Please, can you see what is wrong?

262904-capture.jpg