UI player marker on a moveable map

Hello!

so i got a UI map that can be zoomed in and moved from someone called (Everynone) someone on these forms, but i am trying to make a player marker on the map which shows the location on the UI map relative to the world location but i have no idea how.
if anyone has any idea how to do it will be very helpful.

When a widget is in the centre of that map, it’s at 0,0 coords:

The Point of Interest_3 will represent my player. The image size used is:

image

We need to translate player world coordinates into a canvas coordinate:

  • orange - player world location

mapped onto

  • green - map image size


disclaimer: there’s a chance I mixed up X & Y above. Flip them around if the numbers do not add up. :innocent:

could i ask why did you put -50000 and 50000 for the player world location, because for me the player marker really just vanishes i dont even know where it is. i have put for the map image size for both y and x -3000, 3000 because my image size is 6000x6000 i believe thats what you did but it is not working for me.

I don’t know how big your play area is. This is just an example.

  • 100uus = 1 meter
  • -50000 <=> 50000 assumes your world is 1sq km and you stand in the middle at 0,0

image

the map image size for both y and x -3000, 3000 because my image size is 6000x6000

Sounds fine. If you’re not sure what happens to the player’s icon, observe the values nodes produce.

ok so i added more zeros to the 5000 and -5000 till the player marker showed and it does work when i move my character the marker moves, but now the issue is that the player marker location always starts from the center of the map 0,0 and not the actual location of the player because the player’s location or spawn is not at 0,0. so it doesn’t actually represent the player’s location unless the player always spawns on 0,0

another note: the map isnt always open like the video, as there is no mini map

This should not be the case providing it’s being updated correctly. It’s on Tick, it updates every frame. The map is a widget, feel free to show or hide it as you please. Not really sure what you mean.

so the player marker is set to 0,0 the center of the map UI, so when i play the position of the player marker isnt set to the position of the actual player, it does move with the player but it isnt giving the right position or location

Could you show the script? And the anchor setting of the widget?


so this is the script which is happening inside the widget.

these are the anchor settings.

and here is the player marker and where it starts on the map which is 0,0 of the widget, and the blue is where the player spawns on the current save. so when i start the player marker doesnt go to where the player is currently located, but stays at the center of the map and moves from there.

and sorry if iam taking any time <3

Hiya, I am unable to replicate any of the behaviours you mention. I’ve set up a couple of automated and manual tests with:

  • moving elements
  • static ones
  • elements that spawn dynamically
  • elements in far corners of the map
  • showing and hiding it

For example, a pawn at:

image

Shows up here:

image

And moves accordingly. One note, widgets that are hidden and / or not in the viewport do not Tick. Not sure if relevant here, though. But I’d recommend against widgets pulling data.


My suggestion is to look at the actual numbers your setup is producing.

I will be doing further testing and will get back to you if i achieve anything.

Thank you!

1 Like