Camera Object
The base camera object that the end developer will be interacting with, think of this object as an extendable class that you'll overwrite lifecycle methods on.
Properties
Name
Camera Object.Name <string (opens in a new tab)>
Instance
Camera Object.Instance <Instance (opens in a new tab)>
Methods
OnActivated
Camera Object:OnActivated() -> nil (opens in a new tab)
Lifecycle method that'll invoke once the camera has been activated
local cameraObject = CameraProfile.Camera.new("DefaultCamera")
function cameraObject:OnActivated()
renderStepPrep()
end
OnDeactivated
Camera Object:OnDeactivated() -> nil (opens in a new tab)
Lifecycle method that'll invoke once the camera has been deactivated
local cameraObject = CameraProfile.Camera.new("DefaultCamera")
function cameraObject:OnDeactivated()
cleanUpCamera()
end
OnRenderStepped
Camera Object:OnRenderStepped() -> nil (opens in a new tab)
Render Stepped lifecycle method that'll be called each render stepped when the camera is active
local cameraObject = CameraProfile.Camera.new("DefaultCamera")
function cameraObject:OnRenderStepped()
self.Instance.CFrame = CFrame.new(1, 0, 1)
end
InvokeLifecycleMethod
Camera Object:InvokeLifecycleMethod() -> ...
Attempt to execute a camera object's lifecycle method
local cameraObject = CameraProfile.Camera.new("DefaultCamera")
function cameraObject:methodName(a, b, c)
print(a, b, c) -- 1, 2, 3
end
cameraObject:InvokeLifecycleMethod("methodName", 1, 2, 3)
ToString
Camera Object:ToString() -> string (opens in a new tab)
Get a string'd version of the current Camera instance
CameraProfile.Camera.new("DefaultCamera"):ToString() -- > "Camera<"DefaultCamera">"
Functions
wrap
Camera Object.wrap(
name
string (opens in a new tab),cameraInstance
Instance (opens in a new tab) ) -> Camera Object
Wrap around a Camera instance, the goal being to allow developers to wrap around already instantiated camera objects.
-- wrap around the current workspace camera!
CameraProfile.Camera.wrap("DefaultCamera", workspace.CurrentCamera)
new
Camera Object.new(
name
string (opens in a new tab) ) -> Camera Object
Generate a new camera instance
CameraProfile.Camera.new("CustomCamera")
is
Camera Object.is(
object
any ) -> boolean (opens in a new tab)
Validate if an object is a camera object
CameraProfile.Camera.is(
CameraProfile.Camera.new("CustomCamera")
) -- > true
CameraProfile.Camera.is(
123
) -- > false
get
Camera Object.get(
name
string (opens in a new tab) ) -> Camera Object?
Get a camera object from it's camera name
CameraProfile.Camera.get("DefaultCamera")