I want to create a pause menu with a map. The map of my level is a floor plan image, with a throbber to show the location of my character. Is there a way to translate the character’s position in the level to it’s location on the floor plan image? How can I tell it where on the image the character is with respect to its world position in the level?
I’ve managed to work out something for my project as I needed a similar function.
1 create a actor. I put a billboard component in if (this is just for reference.)
2 create a HUD umg at custom size of the image and in needs to be square for ease of the math, i.e.: 512/512
- In this HUD put a override function to on paint to draw a square, connect context to it and create a variable for its position.
4 in your overall umg you are using insert this user based umg I named radar in the screen location
5 back in the radar umg under tick get actors of all class. Select the radar actor pull a get from it since it’s going to only have one index 0 is fine.
6 from this get its location.
7 get player character. Get its location
8 subtract the 2 get the length from this. It will return you the vector location distance you are from the actor.
8 this is the important part - place the actor in the level on the bottom left of the map in the corner so the entire map where a player can walk is only up and to the right.
Now find out how large it is squared. Ie 100,000 cm?
9 now in the radar umg. You are going to take the vector it returned for distance and break it to use x and y snd divide it by this number. For each.
Take the results of each of those and multiply it by the size of your umg image i.e. 512. This will convert your distance to a number in scale of the image size
Take the x abd y and set that variable you made for the paint override.
You can make a slate brush in that draw square to be the player icon.
This should draw that at your location in relative location of the bottom left of the radar image in pixels.