Drawing Texture at end of line trace

Hi, im back!
This time I am making a 2 part crosshair, it consists of a central dot and an outer ring…

the center dot is the screen center while the outer ring is traced from the muzzle

everything is fine bar the actual drawing of the outer ring…

As the inner dot belongs to inventory HUD i assumed thats where i target the outer ring also

I just cant seem to work out where to draw this

the error is

Error Accessed None ‘InventoryHudReference’ from node Draw Texture in graph ‘EventGraph’ in blueprint EquipmentCharacter

UPDATE: When i cast to inventory hud i get this error

Warning InventoryHUD_C_5 Canvas Draw functions may only be called during the handling of the DrawHUD event

Can you help please?

Anyone…? I even tried to create a new hud… where am i going wrong?

Try and drag off your InventoryHudReference to create a DrawTexture node and see if that makes a difference.
I was able to get this to work by creating a new widget called WB_Crosshair and adding it to the viewport.

I set the crosshair to be exactly in the middle.

And this is what the stuff after your trace looks like. Make sure you untick Remove DPIScale on Set Position in Viewport.


As you can see here the crosshair is aiming over the latest trace location.

Wow @Shirk ok thank you… getting closer…

for some reason tho, i need to set the image to its size 16 x 16 or it wont show, but its too small!

On a herd turn i get this…

Also, as you can see, its not aligned correctly, when i followed yours it would just sit top left… i had to use a preset to make this 50 50 50 50

any thoughts on whats wrong?

I think the codes fine, its the widget setup

(Im sure you know… but the floating crosshair is the outer one O )

The reason its like that is because unless the guns always pointing at where the center of the screen would be in 2D space its not going to align correctly. Basically, if you have your gun aligned straight down the X axis with no rotations during the animation then its will align correctly, but most likely the case is that the gun is attached to the player skeleton and no longer faces directly down the X axis. I hope that makes sense.

Well this is where i got it… I guess im happy enough with this for now at least. Thanks

You see at about 30 seconds… it would be nice to push the camera forward when his head obstructs the target because of the wall if anyones got any ideas?

In a case like that you could try just using a trace from the camera to the crosshair location, and if it hits the player then do whatever you want.