--Camera logic
function OnRenderStep(deltaTime)
--Update continously the camera for the required usages
if currentCameraUsage == "AnchoredDance" then
camera.CFrame = CFrame.new(trackingPart.Position, characterClone.Head.Position)
end
wait(deltaTime)
end
--When a frame renders, use the camera logic
RunService.RenderStepped:Connect(OnRenderStep)
Here is a video describing the issue better:
As you can see, when the character reaches some height, the camera moves abruptly for a moment.
I don’t know how to actually fix that. Any help would be appreciated
–On character move, update camera
function OnCharacterMove(input)
–If the character is on the ground and is not moving, change camera
if characterClone:FindFirstChild(“HumanoidRootPart”) and characterClone.HumanoidRootPart.Velocity.magnitude <= 1 then
if currentCameraUsage == “Follow” then
–Make a clone of the character’s head
trackingPart = characterClone.Head:Clone()
–Anchor it to the character
trackingPart.CFrame = CFrame.new(trackingPart.Position, characterClone.Head.Position)
trackingPart.Parent = characterClone
–Update current camera usage
currentCameraUsage = “AnchoredDance”
end
else
if currentCameraUsage == “AnchoredDance” then
trackingPart:Destroy()
currentCameraUsage = “Follow”
end
end
–If the camera is following the character, update the camera
if currentCameraUsage == “Follow” then
camera.CFrame = CFrame.new(characterClone.Head.Position - 1.5 * characterClone.Head.CFrame.lookVector, characterClone.Head.Position)
end
end
–On character move, use camera logic
game:GetService(“UserInputService”).InputBegan:Connect(OnCharacterMove)
–On camera move, update the clone
function OnCameraMove(input)
–If the camera is not following the character, update the ccloned character
if currentCameraUsage ~= “Follow” then
characterClone.Head.CFrame = camera.CFrame
end
end
–On camera move, use camera logic
game:GetService(“UserInputService”).InputBegan:Connect(OnCameraMove)
You can fix it by setting the camera’s Cframe with the Lerp function. Here is an example:
--Update continously the camera for the required usages
if currentCameraUsage == "AnchoredDance" then
--The camera lerps to the char head position
camera.CFrame = camera.CFrame:Lerp(CFrame.new(trackingPart.Position, characterClone.Head.Position), deltaTime * 4)
end
wait(deltaTime)
end
--When a frame renders, use the camera logic
RunService.RenderStepped:Connect(OnRenderStep)
AIl would have to guess that since you arent using the camera mode of scriptable when the camera changes cframes, the default one it might be on could have limitations on how much pitch it can go, thus making some weird snapping movement when it has too much pitch. You could try changing the camera mode to scriptable if its playing that little cutscene i would guess. Im on phone atm so I cannot test this rn