Camera Handoff
A Camera track drives workspace.CurrentCamera. It takes control when its first section starts and gives it
back when its last section ends, including when the playback is stopped early or a section errors. While Flow
holds the camera, its CameraType is Scriptable; the previous CameraType comes back when Flow lets go.
Roblox's default camera scripts step aside on their own. A custom camera system has to do the same, or it will fight the sequence for the camera every frame.
Deferring a custom camera
Flow.Camera reports who owns the camera and fires
OwnerChanged whenever that changes:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Flow = require(ReplicatedStorage.Flow)
local MyCameraSystem = require(script.Parent.MyCameraSystem)
Flow.Camera.OwnerChanged:Connect(function(newOwner)
MyCameraSystem:SetEnabled(newOwner == nil)
end)
-- A sequence may already hold the camera when this script starts
MyCameraSystem:SetEnabled(not Flow.Camera.IsOwnedByFlow())
newOwner is nil once Flow has let go entirely. The second argument is a label, the playing sequence's name,
which is useful if your camera system should react differently to particular cutscenes.
Several sequences at once
Owners stack. If a second sequence with a Camera track starts while the first holds the camera, the second
takes control, and control returns to the first when the second finishes. OwnerChanged fires at each
change; Flow only hands the camera back to your game when the last owner releases it.
In the editor
While a preview is paused, a Camera track suspends its control so you can fly the camera with Studio's own controls and key the new view. Playing the preview takes control again.
Avoiding jitter
Camera tracks evaluate on the render step, just before the camera updates. A subject animated on Heartbeat moves after that, so a camera that follows it reads its position a frame late. Set the subject's track to Render step in the track menu or the Inspector and the jitter goes away.