Hi I’d like to make a camera that can be moved around a sphere with a mouse, how can I do this?
Could you explain a bit more what you want?
Yeah sure, so what I’m trying to do is a player clicks on a sphere part and their camera focuses on it and they can move the camera around the sphere when holding down their mouse and they can use the scroll wheel to move their camera closer to the sphere or further away.
You can set the camera’s CameraSubject to the part you want it to be attached to.
local RNS = game:GetService("RunService")
local part = -- insert part
local camera = workspace.CurrentCamera
RNS.RenderStepped:Connect(function()
camera.CameraSubject = part
end)
I need to be able to make it go closer to the sphere + further with scroll wheel and be able to be moved around the sphere with their mouse.
That’s what the code does though.
Here’s a question, what is your sphere (is it a model? part? etc.)?
It is a part with a size of 2048
It works but can I up the zoom out distance cause it starts with you being inside the sphere and you can’t zoom out enough.
You can try to just do this :
workspace.CurrentCamera.CameraSubject = --YOURPART
And after put in the StarterPlayer setting a higer distance for the zoom and zoom out !
Alright thanks, is there a way to make them start on a certain zoom in distance?
You can change the CameraMinZoom (e.g. 2048) and CameraMaxZoom (e.g. 3000) to a high value. This makes sure that you don’t have to scroll insanely hard just to see the sphere.
Yes it is the best way !
igore this : zfiejgug
Thanks that works, is there also a way to change this during gameplay for smaller planets and celestial bodies?
You put a script that change the CameraMin and Max zoom when you change planet !
I have tried changing the starter player zoom properties during gameplay but it doesn’t change anything sadly.
Show me your script I think I can help !
This is a test at the moment. I thought that’s how you’d do it.
script.Parent.CameraMaxZoomDistance = 1
script.Parent.CameraMinZoomDistance = 0.1
Ok I got it try this, you will understand !
script.Parent.CameraMinZoomDistance = 0.1
script.Parent.CameraMaxZoomDistance = 1
I don’t think it works, I think there’s a different way of doing this but I’m not sure.