Or, if you prefer to be consistent with the current API, Player.CameraZoomCurrentDistance
Here’s the problem: You can set the range at which a camera is allowed to exist with Player.CameraMaxZoomDistance and Player.CameraMinZoomDistance, but no way to get the current zoom distance nor set the current zoom distance. This is mildly infuriating because it is an incomplete API and I want to set the zoom distance incrementally for use with gamepad controls, while preserving the Camera+(Max||Min)+ZoomDistance API (because I could just set those numbers to the same thing when I want to zoom in and out, but like I said, it’s super hacky and won’t last as a widespread solution if lua code is used to add default gamepad control to games [which it should be {because if it isn’t, that would be really tacky}, to say the least] because not everyone’s idea of a game should fit the character or even have the same controls between them [unless ROBLOX is concerned that it will be “too hard” to remember which game you’re playing]).
This code will not actually do any zooming:
Camera = workspace.CurrentCamera
Stepped = game:GetService("RunService").RenderStepped
while true do
Camera.CoordinateFrame = Camera.CoordinateFrame*CFrame.new(0,0,-1)
Stepped:wait()
end
but something like this will:
Player = game.Players.LocalPlayer
Stepped = game:GetService("RunService").RenderStepped
while true do
if Player.CameraZoomDistance-0.05 < Player.CameraMinZoomDistance then
Player.CameraZoomDistance = Player.CameraMinZoomDistance
break
else
Player.CameraZoomDistance = Player.CameraZoomDistance-0.05
Stepped:wait()
end
end
player.CameraMinZoomDistance = 30
player.CameraMaxZoomDistance = 30
wait() --tested and it needed a wait()
player.CameraMinZoomDistance = 0.5 --default
player.CameraMaxZoomDistance = 400 --default[/quote]
[quote] I want to set the zoom distance incrementally for use with gamepad controls, while preserving the Camera+(Max||Min)+ZoomDistance API (because I could just set those numbers to the same thing when I want to zoom in and out, but like I said, it’s super hacky and won’t last as a widespread solution if lua code is used to add default gamepad control to games.
Sorry to necropost an eight year old thread but im doing it because I believe they should add this still because its somehow still not here after eight whole years. While I understand you can get the camera in certain ways it makes zero sense for them to make specific properties tailored to setting the camera min and max and to not even have one displaying the current zoom. Having to do an overly specific formula just to get it seems stupid.
I know it’s not complicated i never said it’s not complicated i said it was oddly specific and annoying to get something so simple. it should just be a property since it already is one which isnt shown.