Camera

Camera Controls

Camera controls are components that work together with the camera component to display a 3D scene. These components customize corresponding parameters based on different functions and control the display of the 3D scene by affecting the camera's properties.

Camera controls inherit from powerful scripts and are mounted on an Entity that contains the Camera component. Therefore, they can naturally access the Camera, respond to external inputs in lifecycle functions, and perform corresponding operations. These controls cannot currently be added in the editor and must be added by developers in the script.

Note that before adding camera controls, make sure the node has already added the Camera component.

Orbit Controller

OrbitControl is used to simulate orbit interaction, suitable for 360-degree rotation interaction around a target object. Note that the orbit controller must be added after the camera component.

PropertyDescription
targetThe target position to observe
autoRotateWhether to auto-rotate, default is false, can adjust speed via autoRotateSpeed
autoRotateSpeedSpeed of auto-rotation
enableDampingWhether to enable camera damping, default is true
dampingFactorRotation damping parameter, default is 0.1
enableKeysWhether to support keyboard operations (arrow keys)
enablePanWhether to support camera panning, default is true
keyPanSpeedMagnitude of operation when the keyboard is continuously pressed
enableRotateWhether to support camera rotation, default is true
rotateSpeedCamera rotation speed, default is 1.0
enableZoomWhether to support camera zoom, default is true
minAzimuthAngleMinimum azimuth angle for horizontal operations during onUpdate, default is negative infinity
maxAzimuthAngleMaximum azimuth angle for horizontal operations during onUpdate, default is positive infinity
minDistanceMinimum distance for reasonable operations during onUpdate
maxDistanceMaximum distance for reasonable operations during onUpdate
minPolarAngleMinimum polar angle for vertical operations during onUpdate
maxPolarAngleMaximum polar angle for vertical operations during onUpdate

Free Controller

FreeControl is generally used for roaming control, commonly seen in game scenes. Note that the free controller must be added after the camera component.

PropertyDescription
floorMockWhether to simulate the ground, default is true
floorYUsed with floorMock, declares the ground position
movementSpeedMovement speed
rotateSpeedRotation speed

Orthographic Controller

OrthoControl is generally used to control zooming and panning in 2D scenes:

PropertyDescription
zoomSpeedZoom speed
Last updated on July 17, 2024

Was this page helpful?