scaled down
parent
f23218eae9
commit
9715f784b8
|
@ -61,7 +61,15 @@ this.debug = false;
|
||||||
|
|
||||||
this.gravity = -9.8;
|
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) {
|
if (this.debug) {
|
||||||
this.arrowHelper = new THREE.ArrowHelper(
|
this.arrowHelper = new THREE.ArrowHelper(
|
||||||
|
@ -86,9 +94,9 @@ R3.CustomCode.prototype.render = function(delta) {
|
||||||
ball.stopped = true;
|
ball.stopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ball.speed -= delta * 2;
|
ball.speed -= delta / 2;
|
||||||
|
|
||||||
ball.t += delta;
|
ball.t += delta / 2;
|
||||||
|
|
||||||
var u = new THREE.Vector3(
|
var u = new THREE.Vector3(
|
||||||
ball.speed * Math.sin(ball.directionAngle),
|
ball.speed * Math.sin(ball.directionAngle),
|
||||||
|
@ -103,9 +111,9 @@ R3.CustomCode.prototype.render = function(delta) {
|
||||||
/**
|
/**
|
||||||
* Bounce
|
* Bounce
|
||||||
*/
|
*/
|
||||||
if (ball.mesh.position.y <= 0.18) {
|
if (ball.mesh.position.y <= this.ballY) {
|
||||||
ball.s0.x = ball.mesh.position.x;
|
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.s0.z = ball.mesh.position.z;
|
||||||
ball.upAngle *= ball.bounciness;
|
ball.upAngle *= ball.bounciness;
|
||||||
ball.t = 0;
|
ball.t = 0;
|
||||||
|
@ -166,8 +174,8 @@ R3.CustomCode.prototype.render = function(delta) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!ball.scored &&
|
!ball.scored &&
|
||||||
ball.mesh.position.z < -4 &&
|
ball.mesh.position.z < this.startRayZ &&
|
||||||
ball.mesh.position.z > -5
|
ball.mesh.position.z > this.endRayZ
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.raycaster.set(ball.mesh.position, direction);
|
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.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);
|
this.football.parentScene.instance.add(this.activeBall);
|
||||||
}
|
}
|
||||||
|
@ -305,11 +313,11 @@ R3.CustomCode.prototype.move = function(data) {
|
||||||
this.footballPlayer.instance.scale
|
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.rotateY(this.playerRotation.x);
|
||||||
|
|
||||||
this.footballPlayer.instance.translateZ(0.3);
|
this.footballPlayer.instance.translateZ(this.ballY);
|
||||||
|
|
||||||
this.footballPlayer.instance.rotateX(this.playerRotation.y);
|
this.footballPlayer.instance.rotateX(this.playerRotation.y);
|
||||||
|
|
||||||
|
@ -367,8 +375,8 @@ R3.CustomCode.prototype.move = function(data) {
|
||||||
v : v,
|
v : v,
|
||||||
vRotationAxis : vRotationAxis,
|
vRotationAxis : vRotationAxis,
|
||||||
t : 0,
|
t : 0,
|
||||||
s0 : new THREE.Vector3(0,0.18,0),
|
s0 : new THREE.Vector3(0,this.ballY,0),
|
||||||
s1 : new THREE.Vector3(0,0.18,0),
|
s1 : new THREE.Vector3(0,this.ballY,0),
|
||||||
bounciness : 0.5,
|
bounciness : 0.5,
|
||||||
scored : false,
|
scored : false,
|
||||||
scoredThroughGoal : null,
|
scoredThroughGoal : null,
|
||||||
|
@ -384,8 +392,8 @@ R3.CustomCode.prototype.move = function(data) {
|
||||||
|
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
|
|
||||||
this.footballPlayer.instance.translateY(0.78);
|
this.footballPlayer.instance.translateY(this.playerY);
|
||||||
this.football.instance.position.y = 0.18;
|
this.football.instance.position.y = this.ballY;
|
||||||
|
|
||||||
this.mouseMove.entityLoaded = this;
|
this.mouseMove.entityLoaded = this;
|
||||||
this.touchMove.entityLoaded = this;
|
this.touchMove.entityLoaded = this;
|
||||||
|
|
Loading…
Reference in New Issue