Class: FollowingCamera

Grape2D. FollowingCamera

new FollowingCamera(options)

Camera that follows an Grape2D.Object2D, this means that the camera is always looking at the object (the lookAt property is the same as the object)
Parameters:
Name Type Description
options Object Setup options. See Grape2D.Camera
Properties
Name Type Description
objectToFollow Grape2D.Object2D Object to be followed by the camera.
Source:

Extends

Members

<private> cM :Grape2D.Matrix

Computed matrix
Type:
Inherited From:
Source:

<private> icM :Grape2D.Matrix

Inverse of the computed matrix
Type:
Inherited From:
Source:

<private> lookAt :Grape2D.Vector

The position to where the camera is looking at.
Type:
Inherited From:
Source:

<private> scale :Grape2D.Vector

Scale set by the user, should be defined in the matrix.
Type:
Inherited From:
Source:

<private> transformation :Grape2D.Matrix

The transformation matrix to aply to the object coordinates.
Type:
Inherited From:
Source:

Methods

<protected> computeMatrix()

Computes the matrix for better performances.
Inherited From:
Source:

computeShape(renderer) → {Grape2D.Shape}

Creates a shape, based on the camera transformation and renderer properties.
Parameters:
Name Type Description
renderer Grape2D.Renderer The renderer.
Inherited From:
Source:
Returns:
A bounding volume representing the camera view region.
Type
Grape2D.Shape

getLookAt()

Source:

getObjectToFollow() → {Grape2D.Object2D}

Gets the object to follow.
Source:
Returns:
Object that is following.
Type
Grape2D.Object2D

getScale() → {Grape2D.Vector}

Gets the current scale. Scale defined in the transformation is not taken into account.
Inherited From:
Source:
Returns:
Scale
Type
Grape2D.Vector

rescale(scale)

Sets a new scale.
Parameters:
Name Type Description
scale Grape2D.Vector The new scale.
Inherited From:
Source:

setLookAt(position)

Sets the center position to where the camera is looking at.
Parameters:
Name Type Description
position Grape2D.Vector The new look at.
Inherited From:
Source:

setObjectToFollow(fo)

Sets the object to follow.
Parameters:
Name Type Description
fo Grape2D.Object2D Object to follow.
Source:

viewportToWcs(renderer, vector) → {Grape2D.Vector}

Applies the transformation, on a vector in the Viewport Coordinate System (VCS), to get a vector in the World Coordinate System (WSC).
Parameters:
Name Type Description
renderer Grape2D.Renderer The viewport.
vector Grape2D.Vector Vector in the VCS.
Inherited From:
Source:
Returns:
A vector in the WCS
Type
Grape2D.Vector

wcsToViewport(renderer, vector) → {Grape2D.Vector}

Applies the transformation, on a vector in the World Coordinate System (WCS), to get a vector in the Viewport (Renderer) Coordinate System (VSC).
Parameters:
Name Type Description
renderer Grape2D.Renderer The viewport.
vector Grape2D.Vector Vector in the WCS.
Inherited From:
Source:
Returns:
A vector in the VCS
Type
Grape2D.Vector