Download

Make a HUD Icon Point at a target

I’m trying to create a HUD arrow that points from the player to an enemy. I’m doing a line trace from the forward vector of my player to the forward vector of my enemy. I’m then using this to drive the angle of a HUD image. This is ALMOST working, but the left and right values are inverted so when the enemy is on my left, the arrow points right and vice versa. I thought I could just flip the Y-axis of the image by changing the image size Y to -64 but this sadly inverts the vertical axis. The angle is a combined value, so there’s no way I can figure how to invert only the horizontal.
Any ideas?

Oh darn. I just realized this is working less well than I thought. Now that I’ve driven around the enemy more, I’ve discovered that the arrow is not updating properly at all. For example:

I was wanting it to always point in the direction of the enemy bike, but when I move to the side of the enemy and then aim forward, it’s not pointing at it.
Any ideas on how to fix this?

Is this for a pure 2d widget? Also, the ‘bikes’ look awesome!


If your arrow points up by default, the +90 should be -90 instead, most likely. fingers crossed

Nicked it from here:

https://answers.unrealengine.com/questions/1008381/get-angle-between-actors.html