I want to set the current distance at which the camera is from the subject.
local previousMin = plr.CameraMinZoomDistance
local previousMax = plr.CameraMaxZoomDistance
plr.CameraMaxZoomDistance = 12.5
plr.CameraMinZoomDistance = 12.5
plr.CameraMaxZoomDistance = previousMax
plr.CameraMinZoomDistance = previousMin
This code is working, however is there any better solution to this nowadays?
You could reference an Offset variable in addition by changing the Camera’s CFrame? It’d probably look something like this:
local Camera = workspace.CurrentCamera
local Offset = Vector3.new(0, 0, 25) --Or you could reference where the Subject is looking at
Camera.CFrame = CFrame.new(Subject.Position + Offset)
Not sure what you mean though
That doesn’t work unfortunately.
What I want to achieve is, when I change the CameraType (after a cutscene that ends in the default camera CFrame) from Scriptable to Custom you shouldn’t notice a jump like here.
For that, I have to change the CameraZoomDistance before the cutscene starts.
Find the default CFrame offset from the HRP by doing
local travel = HRP.CFrame:Inverse() * camera.CFrame
Then set the cutscene end CFrame to this:
local endCutsceneCameraCFrame = HRP.CFrame * travel
I want the end CFrame with a CameraZoomDistance of 12.5 (which is the default).
Your code would use the current camera CFrame as end CFrame.