Arrows that point toward object in level with UMG/UI (Head in this direction)

Hi there. So I have a top down game and I’m trying to make some sort of system that will display arrows in your UI that will point in the direction your allies or your objective are in, so you can head in that direction.

I have no idea where to start with this however.
I would like to either just have them rotate in the direction that the objective is in, your move around the peripheral of the window/screen to aim you in the direction you should head.

Any help is appreciated, thanks!

Hey there, is the location of the arrow fixed in the UI and it just rotates in place?

Hey there, this will give you the angle between the direction the character is facing and the objective. If you plug this angle into the arrow’s rotation in UMG (the arrow by default needs to be pointing up) it should work.

This worked perfectly! thank you so much, you have no idea how helpfull that was!

Good to know :slight_smile:

I’d like to have the arrow be able to move around the peripheral of the UI, but a fixed one could work as well, and I’d just work from there for achieving the result I want, just not sure where to start.

Thanks for the reply!

3 years later and this formula nailed it for me and my checkpoint arrow for a racing game. thank you!!

You can always count on math :slight_smile:

I’m trying to implement this for a space game where the player rolls. Any solution?

Do you have a reference of how it should look like so i have a better idea of what you need to do?

If you are referring to having an arrow that can go into the corners of the UI based on the target’s position when it’s out of view, then you can project that world space location into screen space and then clamp the result to be within your screen limits.

Does anyone know, how to make it move around the peripheral of the UI?

Can you explain this more specifically like where to do the conversion beteween the world space and screen space plz? thanks !

You need to use things like Project World to Screen | Unreal Engine Documentation