Best way to make UI compass ?

Hello, I’m trying to make a compass (Skyrim-like) with a ruler, the 4 directions and possibly markers in a first person game and I’m not sure what would be the best way of implementing it.

I was thinking parenting a cylinder with the ruler texture wrapped around it on the player character but keep its rotation fixed but I’m unsure how to hide a certain part of it (wouldn’t want the thing to take up the whole screen horizontally) and I’m fairly certain it would screw up when the player looks up or down too much. Would this be the best way or would scripting it on the UI be better ? If scripting it on the UI would be best, how should I proceed ?

I am somewhat experienced in game development but my limited knowledge with Unreal and Google hasn’t been much help to me.

Thanks !

UPDATE : For anyone who would be interested, I solved my problem using a scene capture 2d component located 1000 units below the map parented to the player character. I put a cylinder with a ruler on that scene capture object, the cylinder has its rotation set to 0,0,0 every frame (so that its always oriented the same way). I used material billboard objects for markers on the map and those markers are at the same height the scene capture object is. That scene capture component was rendering onto an image located in the ui.

I have a working 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.

// Normalize a value between 0 and 1 range.

float MinMaxNormalize(float value, float min, float max)
{
	return (value - min) / (max - min);
}

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:

CurrentWorldDirection =  FollowCamera->GetComponentRotation().Yaw;
if (CurrentWorldDirection >= 0.0f)
{
	CurrentWorldDirection = MinMaxNormalize(CurrentWorldDirection, 0.0f, 360.0f);
}
else
{
	CurrentWorldDirection = -MinMaxNormalize(CurrentWorldDirection, 0.0f, -360.0f);
}

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