I’m looking to recreate one of the “space render” systems but instead of planets using maps.
Currently, I’m having an issue replacing planet templates with map templates. Planets (spheres) work as their suppose to, as you fly closer they increase in size until you reach the planet.
Maps, however, seem to be locked at the same size whether you fly closer to them or not. This makes them seem huge from a distance and small as you fly close.
This is the local script I have
local Player = game.Players.LocalPlayer
local Asset = game.ReplicatedStorage.Bodies:Clone()
local Classes = {"BasePart"}
local Bodies = {}
Asset.Parent = workspace.CurrentCamera--Player.Character
check = function(Obj)
for _,c in pairs(Classes) do
if (Obj:IsA(c)) then
return true
end
end
end
scan = function(Parent)
for _,Obj in pairs(Parent:GetChildren()) do
if ((Classes) and (check(Obj))) then
table.insert(Bodies,Obj)
elseif (not Classes) then
table.insert(Bodies,Obj)
end
scan(Obj)
end
end
scan(Asset)
game:GetService("RunService").RenderStepped:connect(function()
for i,v in pairs (Bodies) do
v.CFrame = CFrame.new(workspace.CurrentCamera.CoordinateFrame.p+(v.OriginalPosition.Value-workspace.CurrentCamera.CoordinateFrame.p).unit*4000)
local Constant = (v.OriginalPosition.Value-workspace.CurrentCamera.CoordinateFrame.p).magnitude/4000
v.Mesh.Scale = v.OriginalScale.Value/Constant
end
end)