Update: CC - SnailRunner - Entity Loaded (78gnds8jrj.js) 200 bytes modified

beta.r3js.org
-=yb4f310 2018-03-09 17:18:10 +01:00
parent 269a3f0643
commit 1f30e7c8e6
1 changed files with 13 additions and 11 deletions

View File

@ -34,13 +34,12 @@ this.clouds = [];
this.maxSpeed = 50;
this.speedPercentage = 0;
this.initialCameraPosition = new THREE.Vector3(0, 1.1, 0);
this.maximumCameraPosition = new THREE.Vector3(0, 2.6, 0);
this.currentCameraPosition = new THREE.Vector3(0, 1.1, 0);
this.initialCameraFOV = new THREE.Vector3(0, 40, 0);
this.maximumCameraFOV = new THREE.Vector3(0, 90, 0);
this.currentCameraFOV = new THREE.Vector3(0, 40, 0);
/**
* Camera settings y = height, z = FOV
*/
this.initialCameraSettings = new THREE.Vector3(0, 1.1, 40);
this.maximumCameraSettings = new THREE.Vector3(0, 2.6, 90);
this.currentCameraSettings = new THREE.Vector3(0, 1.1, 40);
/**
* Camera, Raycaster, Mouse
@ -179,13 +178,16 @@ GameLib.CustomCode.prototype.adjustSpeed = function(delta) {
this.speedPercentage = this.speed / this.maxSpeed;
this.currentCameraPosition.lerpVectors(this.initialCameraPosition, this.maximumCameraPosition, this.speedPercentage);
this.currentCameraFOV.lerpVectors(this.initialCameraFOV, this.maximumCameraFOV, this.speedPercentage);
this.currentCameraSettings.lerpVectors(
this.initialCameraSettings,
this.maximumCameraSettings,
this.speedPercentage
);
this.camera.position.y = this.currentCameraPosition.y;
this.camera.position.y = this.currentCameraSettings.y;
this.camera.updateInstance('position');
this.camera.fov = this.currentCameraFOV.y;
this.camera.fov = this.currentCameraSettings.z;
this.camera.updateInstance('fov');