So I am trying to make a Satellite view of my map, everything works. Except the positions/scaling of my waypoints, so how could I achieve the write pos/scale.
local MainFrame = script.Parent.MainFrame
local viewPort = MainFrame:WaitForChild("ViewportFrame")
local charPart = viewPort:WaitForChild("Character")
local height = 5000
local map = workspace.RipOffWorkspace_Because_Yes
map:Clone().Parent = viewPort
local x, z = 0, 0
local Icons = {
["#"] = { }
}
local Waypoints = workspace.Waypoints
function Change_Position(step, change)
if change == "Height" then
height = height - step
elseif change == "X" then
x = x - step
elseif change == "Z" then
z = z - step
end
end
local WaypointPositions = {}
local function SetUpWaypoints()
for _, v in pairs(Waypoints:GetChildren()) do
local Clone = MainFrame.IconTemplate:Clone()
Clone.Name = v.Name
Clone.Visible = true
Clone.Parent = MainFrame
WaypointPositions[Clone] = v.Position
end
end
local function GetPosGround(Position)
return Vector3.new(Position.X, 0, Position.Z)
end
local function PositionIcons()
for i, v in pairs(WaypointPositions) do
local Mag = (GetPosGround(Vector3.new(x, height, z)) - GetPosGround(v)).Magnitude
local PositionX = ((v.X - x)/(height))
local PositionY = ((v.Z - z)/(height))
i.Position = UDim2.new(PositionX, 0, PositionY, 0)
end
end
local camera = Instance.new("Camera", workspace)
camera.CameraType = "Scriptable"
local player = game.Players.LocalPlayer
repeat wait() until player.Character
viewPort.CurrentCamera = camera
local position = player.Character.HumanoidRootPart.Position
camera.CFrame = CFrame.new(Vector3.new(position.X,height,position.Z), position)
SetUpWaypoints()
game:GetService("RunService").RenderStepped:Connect(function ()
camera.CFrame = CFrame.new(Vector3.new(x,height,z), position)
charPart.CFrame = player.Character.HumanoidRootPart.CFrame
PositionIcons()
end)
Enviroment: https://gyazo.com/bd19553b5203691489a8a0d05b19941e