Okay so currently, I am trying to get a little boost on one of my games which involves planetary gravity, I fixed most of the planetary gravity script, almost everything works right now. The current question I have though requires a lot of math which I am really unable to understand. Since I am using planetary gravity, when I go to one side of the planet, I can barely dig, but when I get to the other side of the planet, I can dig properly, I don't know why, I tried to create a part and fill it with air but that was a failure, the terrain simply didn't want to remove itself, I cannot really understand what the problem is but, this is the code i have to dig the terrain:
local recordedPosition = game.Workspace.Terrain:WorldToCellPreferSolid(mouse.Hit.p) local gui = script.Dig:Clone() gui.Enabled = true gui.Parent = script.Parent if game.Workspace.Terrain:WorldToCellPreferSolid(mouse.Hit.p) ~= recordedPosition then gui:Destroy() return end gui.Progress.Bar:TweenSize(UDim2.new(1,0,1,0),"Out","Quad",BarTimer,true) gui:Destroy() if down == true then game.Workspace.Terrain:SetCell(recordedPosition.X,recordedPosition.Y,recordedPosition.Z,0,0,0)
If anyone can help me, I would be greatly happy, thanks for your effort!!
Also, can someone perhaps explain when I would use CellCenterToWorld and WorldToCellPreferSolid??
Also I made that code 8 months ago, please don't hate on me ;(