Camera Methods
Warning
Any method that starts with the character _
is not meant to be called.
new
Camera.new(): SUCamera
Creates a new camera instance.
SetEnabled
Info
If SyncZoom
is enabled, deactivation calls will yield for a short period of time.
Camera:SetEnabled(Enabled: boolean)
Enables or disables the camera based on the passed value: true
to enable and false
to disable the camera.
Destroy
Camera:Destroy()
Cleans up references and connections established by the module. Once the destroy method is invoked on a camera, that camera should never be used again.
ShakeWithInstance
Camera:ShakeWithInstance(CShakeInstance: CameraShakeInstance , Sustain: boolean)
Shake the camera by providing a CameraShakeInstance. You can create a CameraShakeInstance through the CameraShakeInstance's .new()
constructor or by using one of the presets.
The Sustain
parameter determines if the camera shake should be sustained or not.
local NewCameraShakeInstance = ShiftUnlockedModule.CameraShakeInstance.new(5, 5, 0.2, 1.5)
local PresetCameraShakeInstance = ShiftUnlockedModule.CameraShakePresets.Explosion
-- One time explosion
ShiftUnlockedCamera:ShakeWithInstance(PresetCameraShakeInstance, false)
-- Sustained custom shake
ShiftUnlockedCamera:ShakeWithInstance(NewCameraShakeInstance, true)
-- Stop Sustained/One time shakes
NewCameraShakeInstance:StartFadeOut(0) -- Instant Stop
PresetCameraShakeInstance:StartFadeOut(2) -- Gradual stop
Shake
Camera:Shake(Magnitude: number, Roughness: number, Sustain: boolean?, FadeInTime: number?, FadeOutTime: number?, PositionInfluence: Vector3?, RotationInfluence: Vector3?)
Shake the camera by passing the properties of a CameraShakeInstance as arguments directly to the :Shake
method, without the need to provide a predefined CameraShakeInstance. This is particularly useful in scenarios where a preconfigured shake is not applicable.
StopShaking
Camera:StopShaking(FadeOutTime: number?)
Stops all camera shakes using the FadeOutTime
Argument. If no FadeOutTime
is provided then the camera shake's FadeInTime
will be used for each camera shake.
SetZoom
Camera:SetZoom(Zoom: number)
Sets the camera's zoom to the specified zoom number. The provided zoom will be constrained within the minimum and maximum zoom values.
SetCharacter
Camera:SetCharacter(Character)
Sets a character to override the local player's character. You can use any character that contains a humanoid. The character will act as the new character that the camera uses. This feature can be used for spectating other players or NPCs. To re-enable the default behavior, use SetCharacter on the local player's character.