CameraModule overrides the local camera pose and field of view.
Available as the global CameraModule in LocalScripts.
Scripts that read or write this module error with LocalScripts only.
Freecam still uses the engine camera.
Overview
Properties
- .Override : bool
- .Position : Vector3
- .Yaw : number
- .Pitch : number
- .Roll : number
- .Rotation : Vector3
- .FOV : number
Methods
Events
- .Completed : Event ()
API
Properties
Override
Override : bool
When true, the script owns the camera eye and rotation.
Writing Position, Yaw, Pitch, Roll, or Rotation turns this on and snapshots the current view.
Set to false or call Reset to return to the orbit camera.
The local `Player.Camera` Position and Rotation properties drive the same pose.
Position
Position : Vector3
World position of the camera eye.
`PlayerMovementModule.CameraPos` is the same property.
Yaw
Yaw : number
Horizontal look angle in degrees. Same convention as the orbit camera.
Pitch
Pitch : number
Vertical look angle in degrees.
Roll
Roll : number
Bank angle in degrees around the look direction. Default is 0.
Rotation
Rotation : Vector3
X is Yaw, Y is Pitch, Z is Roll.
`PlayerMovementModule.CameraRot` is the same property.
FOV
FOV : number
Vertical field of view in degrees. Default is 60. Range is 1 to 120.
This applies even when Override is false.
FieldOfView is an alias of this property.
Methods
Tween
Tween(goals: table, duration: number, easing: string?) : Tween
Animates camera properties over duration seconds.
easing is optional: "Linear", "Sine", "Quad", or "Cubic".
Supported goal keys: Position, Rotation, Yaw, Pitch, Roll, FOV.
Tweening Position or rotation turns Override on.
CameraModule:Tween({
Position = Vector3.new(0, 20, 40),
Yaw = 180,
FOV = 40,
}, 1.2, "Sine").Completed:Connect(function()
print("cutscene over")
end)
Returns a Tween handle with :Cancel(), :Pause(), :Play(), .PlaybackState, and .Completed.
Reset
Reset() : void
Turns Override off, cancels a running camera tween, and restores FOV to 60.
CameraModule:Reset()
Events
Completed
Completed : Event ()
Fires when a Tween finishes playing to the end.
Cancel does not fire this event.
This is the same Event as the handle's .Completed.
