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

beta.r3js.org
-=yb4f310 2018-03-09 17:29:48 +01:00
parent 1f30e7c8e6
commit fad45f82a6
1 changed files with 26 additions and 14 deletions

View File

@ -41,6 +41,13 @@ this.initialCameraSettings = new THREE.Vector3(0, 1.1, 40);
this.maximumCameraSettings = new THREE.Vector3(0, 2.6, 90); this.maximumCameraSettings = new THREE.Vector3(0, 2.6, 90);
this.currentCameraSettings = new THREE.Vector3(0, 1.1, 40); this.currentCameraSettings = new THREE.Vector3(0, 1.1, 40);
this.intitialSnailSettings = new THREE.Vector3(0, 0, 0);
this.maximumSnailSettings = new THREE.Vector3(0, 0, 0);
this.currentSnailSettings = new THREE.Vector3(0, 0, 0);
this.currentSnailPosition = new THREE.Vector3(0, 0, 0);
this.targetSnailPosition = new THREE.Vector3(0, 0, 0);
/** /**
* Camera, Raycaster, Mouse * Camera, Raycaster, Mouse
*/ */
@ -195,22 +202,24 @@ GameLib.CustomCode.prototype.adjustSpeed = function(delta) {
GameLib.CustomCode.prototype.adjustSnailPosition = function(delta) { GameLib.CustomCode.prototype.adjustSnailPosition = function(delta) {
var diff = delta * 5; // var diff = delta * 5;
var modified = false; // var modified = false;
if (this.movement.left) { // if (this.movement.left) {
this.snail.position.z += diff; // this.snail.position.z += diff;
this.movement.left = false; // this.movement.left = false;
modified = true; // modified = true;
} // }
if (this.movement.right) { // if (this.movement.right) {
this.snail.position.z -= diff; // this.snail.position.z -= diff;
this.movement.right = false; // this.movement.right = false;
modified = true; // modified = true;
} // }
// if (modified) {
this.snail.position.z = this.targetSnailPosition.z;
if (modified) {
if (this.snail.position.z < -4.8) { if (this.snail.position.z < -4.8) {
this.snail.position.z = -4.8; this.snail.position.z = -4.8;
} }
@ -223,7 +232,7 @@ GameLib.CustomCode.prototype.adjustSnailPosition = function(delta) {
this.snail.updateInstance('position'); this.snail.updateInstance('position');
this.solar.updateInstance('position'); this.solar.updateInstance('position');
} // }
}.bind(this); }.bind(this);
@ -242,6 +251,7 @@ GameLib.CustomCode.prototype.update3dCursor = function() {
) )
); );
this.targetSnailPosition.z = cursorPosition.z;
// this.sun.position.setFrom(cursorPosition); // this.sun.position.setFrom(cursorPosition);
// this.sun.updateInstance('position'); // this.sun.updateInstance('position');
@ -278,6 +288,8 @@ GameLib.Event.Subscribe(
this.clouds = []; this.clouds = [];
this.currentSnailPosition.z = this.snail.position.z;
/** /**
* Activate our custom code components * Activate our custom code components
*/ */