Update: CC - SnailRunner - Before Render (94xi7aitax.js) 254 bytes modified
parent
ce12baec6b
commit
9b4a268286
|
@ -7,13 +7,15 @@ if (!this.initialized) {
|
||||||
/**
|
/**
|
||||||
* Meshes
|
* Meshes
|
||||||
*/
|
*/
|
||||||
this.road = this.entityLoaded.road;
|
this.sections = this.entityLoaded.sections;
|
||||||
this.cloud = this.entityLoaded.cloud;
|
this.cloud = this.entityLoaded.cloud;
|
||||||
|
|
||||||
this.time = 0;
|
this.time = 0;
|
||||||
|
|
||||||
|
this.speed = 50;
|
||||||
|
|
||||||
this.spawnCloud = function() {
|
this.spawnCloud = function() {
|
||||||
this.cloud.position.x = 20;
|
this.cloud.position.x = -155;
|
||||||
this.cloud.position.z = (Math.random() * 10) - 5;
|
this.cloud.position.z = (Math.random() * 10) - 5;
|
||||||
this.cloud.updateInstance('position');
|
this.cloud.updateInstance('position');
|
||||||
}
|
}
|
||||||
|
@ -21,13 +23,23 @@ if (!this.initialized) {
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var diff = data.delta * this.speed;
|
||||||
|
|
||||||
//this.road.rotation.z += 0.004 * data.delta;
|
this.cloud.position.x += diff;
|
||||||
//this.road.updateInstance('rotation');
|
|
||||||
|
|
||||||
this.cloud.position.x += data.delta * 2;
|
|
||||||
this.cloud.updateInstance('position');
|
this.cloud.updateInstance('position');
|
||||||
|
|
||||||
|
this.sections.map(
|
||||||
|
function(section) {
|
||||||
|
section.left.position.x += diff;
|
||||||
|
section.road.position.x += diff;
|
||||||
|
section.right.position.x += diff;
|
||||||
|
|
||||||
|
section.left.updateInstance('position');
|
||||||
|
section.road.updateInstance('position');
|
||||||
|
section.right.updateInstance('position');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.time += data.delta;
|
this.time += data.delta;
|
||||||
|
|
||||||
if (this.time > 5) {
|
if (this.time > 5) {
|
||||||
|
|
Loading…
Reference in New Issue