Download

[TUTORIAL] Blueprint Compass (16 Direction)

Hey guys,

This is my first ever tutorial so let me know what you think. In the tutorial I cover how to make a custom function for an in game compass using blueprints and how to create a UMG HUD element in the top right corner which will update when you turn your camera.

I spent most of last night trying to figure out what way was actually North LOL. Looking down on your map from a Top Orthographic view though it is pretty obvious that Y-Axis is North-South. Another confusing part about in game Yaw is that it’s backwards.

Yaw is supposed to go Counter-clockwise, starting with 0 being East, 90 Degrees North. In-game though, Yaw is going clockwise making 90 degrees south.

24829328eca43d9e15cbcfa54a9e7cb38a824d6a.png

**CREDIT GOES TO Vanlacke, as it is his answer to this question below which got me on the idea for this tutorial **

https://answers.unrealengine.com/questions/207184/how-to-find-the-current-direction-of-my-player.html

Reference for the Degrees used in the tutorial

https://docs.google.com/spreadsheets/d/1bo_Mw3uTDkS84LhmM14CaJUsIYGOFzwMFaMkOnI032I/edit?usp=sharing

Hey there, i hope it’s ok to move this thread to the Community Stuff Subforum (:

Turns out I’m blind and didn’t see this sub haha

I will stick that to my forums for later, pretty usefull! thx

That’s my version. Obviously if u divide by 22.5 u can get 16 directions, by 90 for 4 directions

That’s badass, I will have to try it out. Thanks! Much quicker too haha but that is what we are all here for, learning!

This is much faster, but will not loop back to the starting direction smoothly. Great for a quick and dirty compass, though.

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