I need guidance with making my map accurate. Sometimes it is accurate and sometimes it is not.
local function UpPosition()
local x = hrp.Position.x/MapDimensons.X + .263
local z = hrp.Position.Z/MapDimensons.Z + .590
PlayerIcon.Position = UDim2.new(x, 0, z, 0)
end
That is used to update the dot
local MapDimensons = Vector3.new(8694.93, 206.887, 11472.275)
I got the map Dimension by placing 2 parts, one on the top left corner of the map, and one on the bottom right corner. I used
The X and Z distance is being calculated from WorldPosition (0, 0, 0), so your PlayerIcon is getting more and more inaccurate the further away you are from that point. So before your calculation, you’ll need to get the WorldPosition of the center of your map by doing
local MapCenter = (TopLeft.Position + BottomRight.Position) / 2
When you first make these changes, the PlayerIcon could possibly be moving the opposite direction because it depends on how your map has been made on the world axis. Just add a negative after the .5 in the equation to reverse either the XPercent, YPercent, or both. You may also need to reverse the XPercent and YPercent in the PlayerIconUDim2.
I am noticing it is still off when moving away from the center, I made a smaller map and did this to make it more simpler, here is a test place where you can test and see what I mean