diff --git a/ff0fsum4zx.js b/ff0fsum4zx.js index f0dd121..9ba158c 100644 --- a/ff0fsum4zx.js +++ b/ff0fsum4zx.js @@ -61,7 +61,15 @@ this.debug = false; this.gravity = -9.8; -this.initialSpeed = 10; +this.initialSpeed = 5; + +this.startRayZ = -2; + +this.endRayZ = -2.5; + +this.playerY = 0.155; + +this.ballY = 0.0355; if (this.debug) { this.arrowHelper = new THREE.ArrowHelper( @@ -86,9 +94,9 @@ R3.CustomCode.prototype.render = function(delta) { ball.stopped = true; } - ball.speed -= delta * 2; + ball.speed -= delta / 2; - ball.t += delta; + ball.t += delta / 2; var u = new THREE.Vector3( ball.speed * Math.sin(ball.directionAngle), @@ -103,9 +111,9 @@ R3.CustomCode.prototype.render = function(delta) { /** * Bounce */ - if (ball.mesh.position.y <= 0.18) { + if (ball.mesh.position.y <= this.ballY) { ball.s0.x = ball.mesh.position.x; - ball.s0.y = 0.18; + ball.s0.y = this.ballY; ball.s0.z = ball.mesh.position.z; ball.upAngle *= ball.bounciness; ball.t = 0; @@ -166,8 +174,8 @@ R3.CustomCode.prototype.render = function(delta) { if ( !ball.scored && - ball.mesh.position.z < -4 && - ball.mesh.position.z > -5 + ball.mesh.position.z < this.startRayZ && + ball.mesh.position.z > this.endRayZ ) { this.raycaster.set(ball.mesh.position, direction); @@ -293,7 +301,7 @@ R3.CustomCode.prototype.move = function(data) { ); this.activeBall.scale.copy(this.football.instance.scale); - this.activeBall.position.y = 0.18; + this.activeBall.position.y = this.ballY; this.football.parentScene.instance.add(this.activeBall); } @@ -305,11 +313,11 @@ R3.CustomCode.prototype.move = function(data) { this.footballPlayer.instance.scale ); - this.footballPlayer.instance.translateY(0.78); + this.footballPlayer.instance.translateY(this.playerY); this.footballPlayer.instance.rotateY(this.playerRotation.x); - this.footballPlayer.instance.translateZ(0.3); + this.footballPlayer.instance.translateZ(this.ballY); this.footballPlayer.instance.rotateX(this.playerRotation.y); @@ -367,8 +375,8 @@ R3.CustomCode.prototype.move = function(data) { v : v, vRotationAxis : vRotationAxis, t : 0, - s0 : new THREE.Vector3(0,0.18,0), - s1 : new THREE.Vector3(0,0.18,0), + s0 : new THREE.Vector3(0,this.ballY,0), + s1 : new THREE.Vector3(0,this.ballY,0), bounciness : 0.5, scored : false, scoredThroughGoal : null, @@ -384,8 +392,8 @@ R3.CustomCode.prototype.move = function(data) { }.bind(this) -this.footballPlayer.instance.translateY(0.78); -this.football.instance.position.y = 0.18; +this.footballPlayer.instance.translateY(this.playerY); +this.football.instance.position.y = this.ballY; this.mouseMove.entityLoaded = this; this.touchMove.entityLoaded = this;