Download

Rotate Image based on Actor Location

Hey guys! So I setup a Widget Blueprint and inside this BP I have an Image of a compass. I want the North of this compass to point in the direction of my Target Point (NorthPole) and when my character rotates, have it set the N to face the Location of the NorthPole… Any Ideas how I should do this?

I have plenty ideas about it.
But first you need to learn some UMG: UMG UI Designer Quick Start Guide | Unreal Engine Documentation
This shows how to make hp and ammo bars: 2. Displaying Health, Energy and Ammo | Unreal Engine Documentation
This also could help (but its very basic compass): Unreal Engine 4 Tutorial - Compass - YouTube
This is rotating compass tut, made with materials: Unreal Engine 4 Tutorial - UI Compass - YouTube

Then dynamic materials: Instanced Materials | Unreal Engine Documentation
And basics of creating materials: Materials How-To's | Unreal Engine Documentation

You can skip creating materials (well most of it) if you plan to create only UMG animated widget.

Hi, I also have another solution.

Took me a few hours, but it is a UMG Material, with a pan parameter, and then a simple Rotator.yaw calculation.
I use MinMaxNormalize which is exactly the same as NormalizeToRange, but I didn’t include the Kismet math header at the time so… there’s that.
The texture is X seamless, and North is in the middle. If South was in the middle, just simply add 0.5 to each result below.

I use a material, that exposes a float3 parameter, but I only change the ‘R’ or ‘X’ value, between -1 and 1, depending on the heading.

I then calculate the -1 to 1 value using this code:

Then in UMG I created a dynamic material instance, and set my HUD Brush to that, and then applied this Blueprint code in the UMG tick event.
It simply sets the Material Pan ‘R’ parameter value, which is only really offsetting the U of the texture coordinate.

And here is a compass blueprint in the world so I could test my compass. Visible in the top