Camera
Inherits from DynamicInstance
Camera is a class that represents the local player's camera.
Not Creatable ServiceSummary
Properties
Distance:floatFOV:floatFastFlySpeed:floatFlySpeed:floatFollowLerp:boolFreeLookSensitivity:floatHorizontalSpeed:floatIsFirstPerson:boolRead OnlyLerpSpeed:floatMaxDistance:floatMinDistance:floatMode:CameraModeOrthographic:boolOrthographicSize:floatPositionOffset:Vector3RotationOffset:Vector3ScrollSensitivity:floatVerticalSpeed:floatClipThroughWalls:boolSensitivityMultiplier:float
Details
In a running game, each client has its own Camera object which resides in that client's local Environment, accessible through game["Environment"]["Camera"]
The most important camera properties are:
- Mode which is read by the camera scripts and determines how the camera should update per frame
- FOV which represents the visible extent of the observable world
- ClipThroughWalls determines if the camera is able to collide with objects or not
Properties
Distance
Camera.Distance: float
Determines the distance between the camera and the player when the camera is in FollowPlayer mode.
Example
Camera.Distance = 20
FOV
Camera.FOV: float
Determines or returns the camera's field of view.
Example
Camera.FOV = 90
FastFlySpeed
Camera.FastFlySpeed: float
Determines the camera speed when the camera is in FreeCam mode while holding shift.
Example
Camera.FastFlySpeed = 100
FlySpeed
Camera.FlySpeed: float
Determines the camera speed when the camera is in FreeCam mode.
Example
Camera.FlySpeed = 10
FollowLerp
Camera.FollowLerp: bool
Determines whether or not to use lerping in FollowPlayer mode.
Example
Camera.FollowLerp = true
FreeLookSensitivity
Camera.FreeLookSensitivity: float
Determines the mouse sensitivity while in FreeCam mode.
Example
Camera.FreeLookSensitivity = 3
HorizontalSpeed
Camera.HorizontalSpeed: float
Determines the horizontal movement speed of the camera in FollowPlayer mode.
Example
Camera.HorizontalSpeed = 120
IsFirstPerson
Camera.IsFirstPerson: bool
Returns whether or not the camera is in first person.
Example
print(Camera.IsFirstPerson)
LerpSpeed
Camera.LerpSpeed: float
Determines the lerp speed of the camera when lerping is enabled.
Example
Camera.LerpSpeed = 15
MaxDistance
Camera.MaxDistance: float
Determines camera's maximum distance from the player in FollowPlayer mode.
Example
Camera.MaxDistance = 0
MinDistance
Camera.MinDistance: float
The camera's minimum distance from the player in FollowPlayer mode.
Example
Camera.MinDistance = 5
Mode
Camera.Mode: CameraMode
Determines or returns the camera's current mode (Scripted, FollowPlayer, Freecam).
Example
Camera.Mode = CameraMode.Scripted
Orthographic
Camera.Orthographic: bool
Determines whether or not the camera should render in orthographic (2D) mode or not (3D).
Example
Camera.Orthographic = true
OrthographicSize
Camera.OrthographicSize: float
Determines the half-size of the camera when in orthographic mode.
Example
Camera.OrthographicSize = 30
PositionOffset
Camera.PositionOffset: Vector3
Determines the camera's offset from its position.
Example
-- Offsets the camera to be slightly above the player
Camera.PositionOffset = Vector3.New(0, 5, 0)
RotationOffset
Camera.RotationOffset: Vector3
Determines the camera's offset from its rotation.
Example
-- Offsets the camera to be slightly rotated
Camera.RotationOffset = Vector3.New(0, 5, 0)
ScrollSensitivity
Camera.ScrollSensitivity: float
Determines the scroll move speed of the camera.
Example
Camera.ScrollSensitivity = 15
VerticalSpeed
Camera.VerticalSpeed: float
Determines the vertical move speed of the camera.
Example
Camera.VerticalSpeed = 120
ClipThroughWalls
Camera.ClipThroughWalls: bool
Determines whether or not the camera should clip through walls.
Example
Camera.ClipThroughWalls = true
SensitivityMultiplier
Camera.SensitivityMultiplier: float
Example
Camera.SensitivityMultiplier = 1