- Qt 6.7
- Qt 3D
- QML Types
- Qt3D.Render
- Camera
- Qt 6.7.2 Reference Documentation

# Camera QML Type

Defines a view point through which the scene will be rendered. More...

Import Statement: | import Qt3D.Render 2.7
Inherits: | Entity

- List of all members, including inherited members
- Deprecated members

## Properties

- aspectRatio : real
- bottom : real
- exposure : real
- farPlane : real
- fieldOfView : real
- left : real
- lens : CameraLens
- nearPlane : real
- position : vector3d
- projectionMatrix : matrix4x4
- projectionType : enumeration
- right : real
- top : real
- transform : Transform
- upVector : vector3d
- viewCenter : vector3d
- viewVector : vector3d

## Methods

- void pan(real angle)
- void pan(real angle, vector3d axis)
- void panAboutViewCenter(real angle)
- void panAboutViewCenter(real angle, vector3d axis)
- quaternion panRotation(real angle)
- void roll(real angle)
- void rollAboutViewCenter(real angle)
- quaternion rollRotation(real angle)
- void rotate(quaternion q)
- void rotateAboutViewCenter(quaternion q)
- quaternion rotation(real angle, vector3d axis)
- void tilt(real angle)
- void tiltAboutViewCenter(real angle)
- quaternion tiltRotation(real angle)
- void translate(vector3d vLocal, enumeration option)
- void translateWorld(vector3d vWorld, enumeration option)
- void viewAll()
- void viewEntity(Entity entity)
- void viewSphere(vector3d center, real radius)

## Detailed Description

## Property Documentation

aspectRatio : real

Holds the current aspect ratio of the camera.

bottom : real

Holds the current bottom of the camera.

This property is only relevant when projectionType is CameraLens.OrthographicProjection.

exposure : real

Holds the current exposure of the camera.

The default value is 0.0.

The MetalRoughMaterial in Qt 3D Extras is currently the only provided material that makes use of camera exposure. Negative values will cause the material to be darker, and positive values will cause it to be lighter.

Custom materials may choose to interpret the value differently.

farPlane : real

Holds the current camera far plane of the camera. Objects that are farther from the camera than the farPlane will not be rendered.

fieldOfView : real

Holds the current vertical field of view of the camera in degrees.

Along with aspectRatio, this property determines how much of the scene is visible to the camera. In that respect you might think of it as analogous to choosing a wide angle (wide horizontal field of view) or telephoto (narrow horizontal field of view) lens, depending on how much of a scene you want to capture.

fieldOfView is only relevant when projectionType is CameraLens.PerspectiveProjection.

left : real

Holds the current left of the camera.

This property is only relevant when projectionType is CameraLens.OrthographicProjection.

lens : CameraLens

Holds the CameraLens component of the camera.

nearPlane : real

Holds the current camera near plane of the camera. Objects that are closer to the camera than the nearPlane will not be rendered.

position : vector3d

Holds the current position of the camera in coordinates relative to the parent entity.

projectionMatrix : matrix4x4

Holds the current projection matrix of the camera.

projectionType : enumeration

Holds the type of the camera projection. The default value is CameraLens.PerspectiveProjection.

- CameraLens.OrthographicProjection - Parallel lines appear parallel. Objects appear the same size regardless of distance.
- CameraLens.PerspectiveProjection - Parallel lines appear to meet in the distance. Objects appear to shrink the farther they are from the camera.
- CameraLens.FrustumProjection
- CameraLens.CustomProjection

See also Qt3DRender::QCameraLens::ProjectionType.

right : real

Holds the current right of the camera.

This property is only relevant when projectionType is CameraLens.OrthographicProjection.

top : real

Holds the current top of the camera.

This property is only relevant when projectionType is CameraLens.OrthographicProjection.

transform : Transform

Holds the Transform component of the camera.

upVector : vector3d

Holds the current up vector of the camera in coordinates relative to the parent entity.

The up vector indicates which direction the top of the camera is facing. Think of taking a picture: after positioning yourself and pointing the camera at your target, you might rotate the camera left or right, giving you a portrait or landscape (or angled!) shot. upVector allows you to control this type of movement.

viewCenter : vector3d

Holds the current view center of the camera in coordinates relative to the parent entity.

Intuitively, the viewCenter is the location the camera is pointing at.

viewVector : vector3d `[read-only]`

Holds the camera's view vector in coordinates relative to the parent entity.

This vector decribes the displacement from the camera (position) to its target (viewCenter).

## Method Documentation

void pan(real angle)

Adjusts the pan angle of the camera by angle in degrees.

void pan(real angle, vector3d axis)

Adjusts the camera pan about view center by angle in degrees on axis.

void panAboutViewCenter(real angle)

Adjusts the camera pan about view center by angle in degrees.

void panAboutViewCenter(real angle, vector3d axis)

Adjusts the camera pan about view center by angle in degrees on axis.

quaternion panRotation(real angle)

Returns the calculated pan rotation in relation to the angle in degrees taken in to adjust the camera's pan or left/right rotation on the Y axis.

void roll(real angle)

Adjusts the camera roll by angle in degrees.

void rollAboutViewCenter(real angle)

Adjusts the camera roll about view center by angle in degrees.

quaternion rollRotation(real angle)

Returns the calculated roll rotation in relation to the angle in degrees taken in to adjust the camera's roll or lean left/right rotation on the Z axis.

void rotate(quaternion q)

Rotates the camera with the use of a Quaternion in q.

void rotateAboutViewCenter(quaternion q)

Rotates the camera about the view center with the use of a Quaternion in q.

quaternion rotation(real angle, vector3d axis)

Returns the calculated rotation in relation to the angle in degrees and chosen axis taken in.

void tilt(real angle)

Adjusts the tilt angle of the camera by angle in degrees.

void tiltAboutViewCenter(real angle)

Adjusts the camera tilt about view center by angle in degrees.

quaternion tiltRotation(real angle)

Returns the calculated tilt rotation in relation to the angle in degrees taken in to adjust the camera's tilt or up/down rotation on the X axis.

void translate(vector3d vLocal, enumeration option)

Translates the camera's position and its view vector by vLocal in local coordinates. The option allows for toggling whether the view center should be translated.

- Camera.TranslateViewCenter
- Camera.DontTranslateViewCenter

See also Qt3DRender::QCamera::CameraTranslationOption.

void translateWorld(vector3d vWorld, enumeration option)

Translates the camera's position and its view vector by vWorld in world coordinates. The option allows for toggling whether the view center should be translated.

- Camera.TranslateViewCenter
- Camera.DontTranslateViewCenter

See also Qt3DRender::QCamera::CameraTranslationOption.

void viewAll()

Rotates and moves the camera so that it's viewCenter is the center of the scene's bounding volume and the entire scene fits in the view port.

Note: Only works if the lens is in perspective or orthographic projection mode.

See also Qt3D.Render::Camera::projectionType.

void viewEntity(Entity entity)

Rotates and moves the camera so that it's viewCenter is the center of the entity's bounding volume and the entire entity fits in the view port.

Note: Only works if the lens is in perspective or orthographic projection mode.

See also Qt3D.Render::Camera::projectionType.

void viewSphere(vector3d center, real radius)

Rotates and moves the camera so that it's viewCenter is center and a sphere of radius fits in the view port.

Note: Only works if the lens is in perspective or orthographic projection mode.

See also Qt3D.Render::Camera::projectionType.