How to make camera relative to sphere instead of workspace

How to make camera relative to sphere instead of workspace.

this is how it looks

I’ve already tried to do it but it doesnt work

any Ideas?

2 Likes

Boster (ogofdogfdingfgjhdhdjghdgujdg)

More Boost xfdfsdfdffddf
df

fd
f
dfd

To make an object relative position to another object, you use ToObjectSpace:

script example?
fdfdfd fdfd fdfdf df

wait, actually I know what you mean. ToObjectSpace wouldn’t work in this case.

so how would i fix this problem btw im using ego moose’s gravity controller+

To make the camera follow the sphere, you could make something so that the camera constantly follows the player’s movement as they go down the sphere. That would require some math.

with my own spherical generator

k no prob if i can make a sphere generato r i can do some more math

You could follow the player’s Z axis, because when they are going down the sphere, Z axis changes because they are moving down/up. So you could make camera move the Z axis together with the player.

made this

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local planetCenter = Vector3.new(0, 5000, 0) 
camera.CameraType = Enum.CameraType.Custom

RunService:BindToRenderStep("PlanetCameraUp", Enum.RenderPriority.Camera.Value + 1, function()
	if not player.Character or not player.Character:FindFirstChild("HumanoidRootPart") then return end

	local root = player.Character.HumanoidRootPart
	local up = (root.Position - planetCenter).Unit

	camera.CFrame = CFrame.lookAt(camera.CFrame.Position, camera.CFrame.Position + camera.CFrame.LookVector, up)
end)

That’s good, try seeing if this works now.

it does just now , when i go to the bottom or side the mouse is the one that is nt relative

now i have to find a way to make the mouse work the same way

Additionally, you could enable this “camera follow” system whenever the player is inside the “planet,” and disable it when they leave the planet. I think you’ve got it.

To make the mouse work the same way, you can just make it fixed in the middle of the screen, right?

no im talking about rotating the camera with the mouse

What do you mean? Do you have any examples for what you want to achieve?

wait never mind you had the right i dea thanks

1 Like