The [ThirdPersonView] class is a subclass of View. This view creates a "camera" in a position that looks at an exact position, position using the direction, distance and orientation specified by the application, in contrast with e.g. FirstPersonView that looks out from the position specified in the view state.
To render, a ThirdPersonView needs to be combined with a viewState object with the following parameters:
position(Number[3]) - position
A ThirdPersonView will work with geospatial coordinate systems if a geospatial "anchor point" is provided in the viewState via:
longitudelatitudezoom
The position vector will then be interpreted as meter offsets from this anchor point.
For more information on using View classes, consult the Views article.
const view = new ThirdPersonView({
// Projection parameters (perspective projection)
fov: 45
});new ThirdPersonView({fov: 45, width: 500, height: 500, ...});ThirdPersonView takes the same parameters as the View superclass constructor.
Parameters:
-
opts(Object) - Third person view optionsprojection matrix arguments:
fov(Number, optional) - Field of view covered by camera. Default to75.near(Number, optional) - Distance of near clipping plane. Default to1.far(Number, optional) - Distance of far clipping plane. Default to100.aspect(Number, optional) - Aspect ratio. Default to the view'swidth/height.
See View constructor for additional parameters, especially for specifying alternate projection matrices, geospatial anchor etc.
Inherits all View methods.
- Like all
Views, theThirdPersonViewwill work with all geospatial coordinate systems if a geospatial "anchor point" is supplied through thelongitude,latitudeandzoomoptions. Thepositionvector will then be interpreted as meter offsets from this anchor point.