From 64fb196315f481dc3eaee8211c20c022c98a0a7e Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 9 Mar 2018 17:07:58 +0100 Subject: [PATCH] Update: CC - SnailRunner - Entity Loaded (78gnds8jrj.js) 418 bytes modified --- 78gnds8jrj.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/78gnds8jrj.js b/78gnds8jrj.js index 3e2e56d..85d82e3 100644 --- a/78gnds8jrj.js +++ b/78gnds8jrj.js @@ -31,6 +31,13 @@ this.sun = GameLib.EntityManager.Instance.findComponentById('nkdyvga5nl'); this.sections = []; 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); + + /** * Camera, Raycaster, Mouse */ @@ -162,10 +169,17 @@ GameLib.CustomCode.prototype.adjustSpeed = function(delta) { this.speed = 0; } - if (this.speed > 50) { - this.speed = 50; + if (this.speed > this.maxSpeed) { + this.speed = this.maxSpeed; } + this.speedPercentage = this.speed / this.maxSpeed; + + var pos = this.initialCameraPosition.lerp(this.maximumCameraPosition, this.speedPercentage); + + this.camera.position.y = pos.y; + this.camera.updateInstance('position'); + }.bind(this); GameLib.CustomCode.prototype.adjustSnailPosition = function(delta) {