Class: Camera

pc.Camera

A camera.

Constructor

(private) new Camera()

Source:

Members

(private) aspectRatio :Number

Camera's aspect ratio.
Type:
  • Number
Source:

(private) clearColor :Array

Camera's clear color.
Type:
  • Array
Source:

(private) clearDepth :Number

Camera's clear depth value.
Type:
  • Number
Source:

(private) clearFlags :Number

Camera's clear flags bits value.
Type:
  • Number
Source:

(private) clearStencil :Number

Camera's clear stencil value.
Type:
  • Number
Source:

(private) farClip :Number

Camera's distance to far clipping plane
Type:
  • Number
Source:

(private) fov :Number

Camera's field of view in degrees. This angle is in degrees and is measured vertically or horizontally between the sides of camera planes. hirozontalFov property defines the fov axis - vertical or horizontal.
Type:
  • Number
Source:

(private) horizontalFov :Boolean

Camera's horizontal or vertical field of view.
Type:
  • Boolean
Source:

(private) nearClip :Number

Camera's distance to near clipping plane
Type:
  • Number
Source:

(private) orthoHeight :Number

Camera's half height of the orthographics view.
Type:
  • Number
Source:

(private) projection :Number

Camera's projection type, to specify whether projection is orthographic (parallel projection) or perspective. Can be:
Type:
  • Number
Source:

Methods

(private) clone() → {pc.Camera}

Duplicates a camera node but does not 'deep copy' the hierarchy.
Source:
Returns:
A cloned Camera.
Type
pc.Camera

(private) getClearOptions() → {Object}

Retrieves the options used to determine how the camera's render target will be cleared.
Source:
Returns:
The options determining the behaviour of render target clears.
Type
Object

(private) getProjectionMatrix() → {pc.Mat4}

Retrieves the projection matrix for the specified camera.
Source:
Returns:
The camera's projection matrix.
Type
pc.Mat4

(private) getViewMatrix() → {pc.Mat4}

Retrieves the view matrix for the specified camera based on the entity world transformation.
Source:
Returns:
The camera's view matrix.
Type
pc.Mat4

(private) screenToWorld(x, y, z, cw, ch, worldCoordopt) → {pc.Vec3}

Convert a point from 2D canvas pixel space to 3D world space.
Parameters:
Name Type Attributes Description
x Number x coordinate on PlayCanvas' canvas element.
y Number y coordinate on PlayCanvas' canvas element.
z Number The distance from the camera in world space to create the new point.
cw Number The width of PlayCanvas' canvas element.
ch Number The height of PlayCanvas' canvas element.
worldCoord pc.Vec3 <optional>
3D vector to receive world coordinate result.
Source:
Returns:
The world space coordinate.
Type
pc.Vec3

(private) setClearOptions(options)

Sets the options used to determine how the camera's render target will be cleared.
Parameters:
Name Type Description
options Object The options determining the behaviour of subsequent render target clears.
Properties
Name Type Description
color Array.<Number> The options determining the behaviour of subsequent render target clears.
depth Number The options determining the behaviour of subsequent render target clears.
flags pc.CLEARFLAG The options determining the behaviour of subsequent render target clears.
Source:

(private) worldToScreen(worldCoord, cw, ch, screenCoordopt) → {pc.Vec3}

Convert a point from 3D world space to 2D canvas pixel space.
Parameters:
Name Type Attributes Description
worldCoord pc.Vec3 The world space coordinate to transform.
cw Number The width of PlayCanvas' canvas element.
ch Number The height of PlayCanvas' canvas element.
screenCoord pc.Vec3 <optional>
3D vector to receive screen coordinate result.
Source:
Returns:
The screen space coordinate.
Type
pc.Vec3