setCamera method
dynamic
setCamera(
- dynamic camera
- Set the camera to be controlled
- @param {Camera} camera The virtual camera to be controlled
Implementation
setCamera(camera) {
camera.lookAt(this.target);
camera.updateMatrix();
//setting state
if (camera.type == 'PerspectiveCamera') {
this._fov0 = camera.fov;
this._fovState = camera.fov;
}
this._cameraMatrixState0.copy(camera.matrix);
this._cameraMatrixState.copy(this._cameraMatrixState0);
this._cameraProjectionState.copy(camera.projectionMatrix);
this._zoom0 = camera.zoom;
this._zoomState = this._zoom0;
this._initialNear = camera.near;
this._nearPos0 = camera.position.distanceTo(this.target) - camera.near;
this._nearPos = this._initialNear;
this._initialFar = camera.far;
this._farPos0 = camera.position.distanceTo(this.target) - camera.far;
this._farPos = this._initialFar;
this._up0.copy(camera.up);
this._upState.copy(camera.up);
this.camera = camera;
this.camera.updateProjectionMatrix();
//making gizmos
this._tbRadius = this.calculateTbRadius(camera);
this.makeGizmos(this.target, this._tbRadius);
}