Getting Started

  1. Place the CameraPlus API ModuleScript into your ROBLOX game
  2. Load the ModuleScript into a LocalScript using the require method
local camera = require(game.Workspace.CameraPlus)

API Quick Look

Inherited Ease SetPosition GetPosition SetFocus SetView SetFOV GetFOV IncrementFOV IncrementRoll Tween TweenTo TweenToPlayer TweenFOV TweenToFOV TweenRoll TweenToRoll TweenAll TweenToAll Interpolate

API Reference

Inherited methods and properties

CameraPlus inherits all properties and methods that the normal Camera object has. This is done programmatically simply by redirecting API property or method requests to the normal camera object if the API does not have the requested property or method.

Example:

local camera = require(game.Workspace.CameraPlus)
camera.Name = "MyCamera"
camera:SetRoll(math.rad(45))
camera.FieldOfView = 35
camera:IsA("Camera")
camera.CameraType = Enum.CameraType.Scriptable
camera.Ease

A table containing easing functions used for camera interpolation

Contains the tables:

  • camera.Ease.In
  • camera.Ease.Out
  • camera.Ease.InOut

Each of those tables contain the following functions:

  • Linear
  • Quad
  • Cubic
  • Quart
  • Quint
  • Sine
  • Expo
  • Circ
  • Elastic
  • Back
  • Bounce

Example:

local sineInOut = camera.Ease.InOut.Sine
local circOut = camera.Ease.Out.Circ
local expoIn = camera.Ease.In.Expo
local linear = camera.Ease.InOut.Linear
camera:SetPosition(Vector3 position)

Set the position of the camera

Note: The camera continues to look at the last position it was looking at

Example:

camera:SetPosition(Vector3.new(0, 10, 40))
camera:GetPosition()

Get the position of the camera

Example:

local position = camera:GetPosition()
camera:SetFocus(Vector3 focus)

Set the position of which the camera is looking at (the focus)

Example:

camera:SetFocus(Vector3.new(10, 0, 0))
camera:SetView(Vector3 position, Vector3 focus)

Set the position and focus of the camera

Example:

camera:SetView(Vector3.new(10, 0, 0), Vector3.new(0, 0, 0))
camera:SetFOV(Number fieldOfView)

Set the camera's field of view (in degrees)

Example:

camera:SetFOV(45)
camera:GetFOV()

Get the camera's field of view (in degrees)

Example:

local fieldOfView = camera:GetFOV()
camera:IncrementFOV(Number deltaFieldOfView)

Increment the camera's current field of view

Example:

-- Increment field of view by 1 ten times:
for i = 1,10 do
	camera:IncrementFOV(1)
	Wait()
end
camera:IncrementRoll(Number deltaRoll)

Increment the roll of the camera (in radians)

Example:

camera:IncrementRoll(math.rad(5))
camera:Tween(CFrame cfStart, CFrame cfEnd, Number duration, Function easingFunction)

Tween the camera from one CFrame to the next

Example:

camera:Tween(
	CFrame.new(Vector3.new(0, 0, 0), Vector3.new(0, 0, 10)),    -- Start position and focus
	CFrame.new(Vector3.new(10, 10, 10), Vector3.new(0, 0, 10)), -- End position and look
	3,                                                          -- Duration (in seconds)
	camera.Ease.InOut.Quad                                      -- Easing function
)
camera:TweenTo(CFrame cfEnd, Number duration, Function easingFunction)

Tween the camera to the given endpoint CFrame (camera will start at its current position)

Example:

camera:TweenTo(
	CFrame.new(Vector3.new(10, 10, 10), Vector3.new(0, 0, 10)), -- End position and focus
	3,                                                          -- Duration (in seconds)
	camera.Ease.InOut.Quad                                      -- Easing function
)
camera:TweenToPlayer(Number duration, Function easingFunction)

Tween the camera from the current position back to the player.
Doing so will disable the current player from moving until the camera is back to the player. The camera will automatically switch back to the Custom CameraType as well.

Example:

camera:TweenToPlayer(3, camera.Easing.InOut.Sine)
camera:TweenFOV(Number startFieldOfView, Number endFieldOfView, Number duration, Function easingFunction)

Tween the field of view from one value to the next

Example:

camera:TweenFOV(
	70,                     -- Starting Field of View
	20,                     -- Ending Field of View
	3,                      -- Duration
	camera.Ease.InOut.Expo  -- Easing function
)
camera:TweenToFOV(Number endFieldOfView, Number duration, Function easingFunction)

Tween the field of view from the current value to the given ending value

Example:

camera:TweenToFOV(
	20,                     -- Ending Field of View
	3,                      -- Duration
	camera.Ease.InOut.Expo  -- Easing function
)
camera:TweenRoll(Number startRoll, Number endRoll, Number duration, Function easingFunction)

Tween the roll from the starting value to the ending value

Example:

camera:TweenRoll(
	math.rad(0),            -- Starting roll
	math.rad(270),          -- Ending roll
	3,                      -- Duration
	camera.Ease.InOut.Expo  -- Easing function
)
camera:TweenToRoll(Number endRoll, Number duration, Function easingFunction)

Tween the roll from the current value to the given ending value

Example:

camera:TweenToRoll(
	math.rad(270),          -- Ending roll
	3,                      -- Duration
	camera.Ease.InOut.Expo  -- Easing function
)
camera:TweenAll(CFrame cfStart, CFrame cfEnd, Number fieldOfViewStart, Number fieldOfViewEnd, Number rollStart, Number rollEnd, Number duration, Function easingFunction)

Tween all major aspects of the camera

Example:

camera:TweenAll(
	CFrame.new(Vector3.new(0, 0, 0), Vector3.new(0, 0, 10)),    -- Start position and focus
	CFrame.new(Vector3.new(10, 10, 10), Vector3.new(0, 0, 10)), -- End position and focus
	70,                                                         -- Start Field of View
	20,                                                         -- End Field of View
	math.rad(0),                                                -- Start roll
	math.rad(270),                                              -- End roll
	3,                                                          -- Duration (in seconds)
	camera.Ease.InOut.Quint                                     -- Easing function
)
camera:TweenToAll(CFrame cfEnd, Number fieldOfViewEnd, Number rollEnd, Number duration, Function easingFunction)

Tween all major aspects of the camera starting at the camera's current state

Example:

camera:TweenToAll(
	CFrame.new(Vector3.new(10, 10, 10), Vector3.new(0, 0, 10)), -- End position and focus
	20,                                                         -- End Field of View
	math.rad(270),                                              -- End roll
	3,                                                          -- Duration (in seconds)
	camera.Ease.InOut.Quint                                     -- Easing function
)
camera:Interpolate(Vector3 endPosition, Vector3 endFocus, Number duration)

Exactly the same as the camera's default Interpolation function, except a Sine easing function is applied to the interpolation.

Example:

camera:Interpolate(
	Vector3.new(10, 30, 20),  -- End position
	Vector3.new(0, 0, 10),    -- End focus
	3                         -- Duration
)