LavaUI docs GitHub

struct CameraControls3D

Swift

struct CameraControls3D

How a Scene3D's camera follows the pointer: drag to orbit, Shift-drag to pan, wheel to zoom.

Sources/LavaUI/Spatial.swift:104

Constructors

init(orbitSensitivity: Float = 0.006, panSensitivity: Float = 0.0018, zoomSensitivity: Float = 0.12, minimumDistance: Float = 2, maximumDistance: Float = 20, minimumPitch: Angle3D = .degrees(-75), maximumPitch: Angle3D = .degrees(75), inertia: Bool = true, deceleration: Float = 0.88)

Creates controls. Values are clamped into sense: sensitivities to zero or more, the maximum distance to at least the minimum, the pitch limits into order and the deceleration into 0–0.999.

Sources/LavaUI/Spatial.swift:128

Properties

var deceleration: Float

Fraction of drag velocity retained per 60 Hz frame.

Sources/LavaUI/Spatial.swift:123

var inertia: Bool

Whether a released drag keeps the camera moving and slowing down.

Sources/LavaUI/Spatial.swift:121

var maximumDistance: Float

Farthest the camera may zoom from its target.

Sources/LavaUI/Spatial.swift:115

var maximumPitch: Angle3D

Highest the camera may orbit, looking down at the target.

Sources/LavaUI/Spatial.swift:119

var minimumDistance: Float

Closest the camera may zoom to its target.

Sources/LavaUI/Spatial.swift:113

var minimumPitch: Angle3D

Lowest the camera may orbit, looking up at the target.

Sources/LavaUI/Spatial.swift:117

var orbitSensitivity: Float

Radians of orbit per pixel dragged.

Sources/LavaUI/Spatial.swift:106

var panSensitivity: Float

Pan distance per pixel dragged, as a fraction of the distance to the target.

Sources/LavaUI/Spatial.swift:108

var zoomSensitivity: Float

How strongly one wheel notch zooms. The distance is multiplied by exp(-notches × zoomSensitivity).

Sources/LavaUI/Spatial.swift:111

Methods

static func orbit(minimumDistance: Float = 2, maximumDistance: Float = 20, inertia: Bool = true) -> CameraControls3D

Orbit controls with the default sensitivities and the given distance limits.

Sources/LavaUI/Spatial.swift:151