I’m working on a Space exploration game and looking for methods to avoid the floating point errors when far from Origin.
Currently I’m experimenting with size, I’ve shrank the ship down to a mere 0.01; the Baseplate shown is 100, 1, 100 in size.
I intend to have the ships travel at 0.01 to give the illusion of slower movement across vast distance (Ofc there’ll be Hyperdrive etc.)
Would this work or does anyone have any other suggestions?
hey(probably the original poster won’t see this but it is for future people looking here) i tryed to make some code that fixes this problem right now it’s looking like this:
local times = 0
local max_distance = 1000
game:GetService("RunService").PreSimulation:Connect(function()
if times > 0 then
return
end
local plr:Player = game.Players.LocalPlayer
if nil == plr.Character then
warn("no character")
return
end
local rootpart:Part = plr.Character.HumanoidRootPart
if nil == rootpart then
return
end
if (rootpart.CFrame.Position).Magnitude < max_distance then
return
end
local lastcframe = rootpart.CFrame
rootpart.CFrame -= rootpart.Position
game.Workspace:MoveTo(game.Workspace.WorldPivot.Position - lastcframe.Position)
rootpart.CFrame += lastcframe.Position
end)
it basicaly sets the player’s position to 0,0,0 when a treshold is met and readjusts the workspace’s positions to match that
It has the issue though if you teleport the player too far it just puts them under the map for some reason(the quick fix right now is to just either increase the max_distance or make the teleport do steps of max_distance untill you are able to reach where you want)