Skip to main content

Object3DLineLineSegments

CameraHelper

This helps with visualizing what a camera contains in its frustum. It visualizes the frustum of a camera using a LineSegments.

CameraHelper must be a child of the scene.

Code Example

const camera = new THREE.PerspectiveCamera( 75, window.innerWidth /
window.innerHeight, 0.1, 1000 );const helper = new THREE.CameraHelper( camera
);scene.add( helper );

Examples

[example:webgl_camera WebGL / camera]
[example:webgl_geometry_extrude_splines WebGL / extrude / splines]

Constructor

CameraHelper

function CameraHelper( camera: Camera ): void;  

camera -- The camera to visualize.

This create a new [Name] for the specified camera.

Properties

See the base LineSegments class for common properties.

camera

camera: Camera;  

The camera being visualized.

pointMap

pointMap: Object;  

This contains the points used to visualize the camera.

matrix

matrix: Object;  

Reference to the camera.matrixWorld.

matrixAutoUpdate

matrixAutoUpdate: Object;  

See Object3D.matrixAutoUpdate. Set to false here as the helper is using the camera's matrixWorld.

Methods

See the base LineSegments class for common methods.

dispose

function dispose( ): undefined;  

Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.

setColors

function setColors( frustum: Color, cone: Color, up: Color, target: Color,
cross: Color ): this;

Defines the colors of the helper.

update

function update( ): undefined;  

Updates the helper based on the projectionMatrix of the camera.

Source

src/helpers/CameraHelper.js