local camera = require(game.Workspace.CameraPlus)
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
A table containing easing functions used for camera interpolation
Contains the tables:
Each of those tables contain the following functions:
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
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))
Get the position of the camera
Example:
local position = camera:GetPosition()
Set the position of which the camera is looking at (the focus)
Example:
camera:SetFocus(Vector3.new(10, 0, 0))
Set the position and focus of the camera
Example:
camera:SetView(Vector3.new(10, 0, 0), Vector3.new(0, 0, 0))
Set the camera's field of view (in degrees)
Example:
camera:SetFOV(45)
Get the camera's field of view (in degrees)
Example:
local fieldOfView = camera:GetFOV()
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
Increment the roll of the camera (in radians)
Example:
camera:IncrementRoll(math.rad(5))
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
)
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
)
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)
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
)
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
)
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
)
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
)
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
)
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
)
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
)