Skip to content

CameraOrbit

Class ยท client scripts

CameraOrbit drives a third-person orbit camera around Subject with mouse, touch, and stick steering, zoom bounds, wall collision avoidance, and subject proximity fade. Access it through camera.CameraOrbit on the client.

Example

-- Client script.
local cam = World.Viewport.Camera
local orbit = cam and cam.CameraOrbit
if orbit then
    orbit.Distance = 12
    orbit.MinDistance = 4
    orbit.MaxDistance = 24
end

Subject

Property
Subject: Entity?

Subject is the entity the orbit camera follows, or nil when unbound.

Yaw

Property
Yaw: number

Yaw is the horizontal orbit angle around Subject, in radians.

Pitch

Property
Pitch: number

Pitch is the vertical orbit angle around Subject, in radians.

Distance

Property
Distance: number

Distance is the target distance from Subject, in world units.

SideOffset

Property
SideOffset: number

SideOffset shifts the camera laterally from Subject, in world units.

Sensitivity

Property
Sensitivity: number

Sensitivity scales mouse look delta applied to Yaw and Pitch.

SmoothDistance

PropertyRead only
SmoothDistance: number

SmoothDistance is the smoothed distance applied on the current frame.

SmoothSideOffset

PropertyRead only
SmoothSideOffset: number

SmoothSideOffset is the smoothed lateral offset applied on the current frame.

Fade

PropertyRead only
Fade: number

Fade is the proximity fade fraction applied to Subject on the current frame, from 0 (opaque) to 1 (hidden).

Clearance

PropertyRead only
Clearance: number

Clearance is the distance left by a wall obstructing the camera, or 0 while nothing blocks the sightline.

PitchLimit

Property
PitchLimit: number

PitchLimit is the steepest pitch allowed in radians either way; 0 permits nearly 90 degrees.

PitchEase

Property
PitchEase: number

PitchEase is the margin in radians before PitchLimit where stick turns ease to a stop.

FollowTime

Property
FollowTime: number

FollowTime is the time constant in seconds for the focal height to trail Subject; 0 tracks rigidly.

FollowLimit

Property
FollowLimit: number

FollowLimit caps how far vertically the focal height can trail Subject; 0 sets no cap.

FollowLift

PropertyRead only
FollowLift: number

FollowLift is the vertical distance the focal trails Subject by on the current frame.

FollowSpeed

PropertyRead only
FollowSpeed: number

FollowSpeed is the current vertical velocity of the trailing focal point.

CollisionEase

Property
CollisionEase: number

CollisionEase is the distance over which a wall behind the camera eases it inward; 0 snaps immediately.

PitchPull

Property
PitchPull: number

PitchPull is the fraction of Distance pulled inward near the upper pitch limit; 0 disables pull-in.

TouchScale

Property
TouchScale: number

TouchScale multiplies touch drag look relative to mouse look; 0 uses the same scale as mouse look.

CollisionRadius

Property
CollisionRadius: number

CollisionRadius is the sphere radius kept clear of walls when testing camera obstruction; 0 uses a thin ray.

ZoomSpeed

Property
ZoomSpeed: number

ZoomSpeed is the natural logarithm of distance growth per second during zoom motion; negative values zoom inward.

Punch

Property
Punch: vector

Punch adds pitch, yaw, and roll angles in radians to the view after orbit positioning.

PunchOffset

Property
PunchOffset: vector

PunchOffset shifts the camera in its own frame after orbit positioning: X right, Y up, Z back.

FadeStart

Property
FadeStart: number

FadeStart is the camera distance where Subject starts fading out.

FadeEnd

Property
FadeEnd: number

FadeEnd is the camera distance where Subject finishes fading out.

MinDistance

Property
MinDistance: number

MinDistance is the closest distance the orbit camera zooms in to.

MaxDistance

Property
MaxDistance: number

MaxDistance is the farthest distance the orbit camera zooms out to.

SnapDistance

Property
SnapDistance: number

SnapDistance is the distance below which zoom snaps directly to MinDistance; 0 disables snapping.

ZoomStep

Property
ZoomStep: number

ZoomStep is the fraction of distance stepped per mouse wheel tick.

SmoothRate

Property
SmoothRate: number

SmoothRate is the exponential smoothing rate per second; 0 snaps without smoothing.

EyeHeight

Property
EyeHeight: number

EyeHeight is the vertical focal offset above Subject, in world units.

SpinSpeed

Property
SpinSpeed: number

SpinSpeed is the angular speed in radians per second turned by camera spin keys.

CollisionSkin

Property
CollisionSkin: number

CollisionSkin is the standoff margin kept off a wall hit by the camera obstruction check.

Active

Property
Active: boolean

Active drives camera Position and Rotation from the orbit rig when true; false leaves transform control to scripts.

FadeEnabled

Property
FadeEnabled: boolean

FadeEnabled fades Subject when the camera moves closer than FadeStart.