diff --git a/ff0fsum4zx.js b/ff0fsum4zx.js index 92faf75..33b30f0 100644 --- a/ff0fsum4zx.js +++ b/ff0fsum4zx.js @@ -188,7 +188,7 @@ R3.CustomCode.prototype.render = function(delta) { var goalDistanceL = this.goalL.position.distanceTo(ball.mesh.position); var goalDistanceR = this.goalR.position.distanceTo(ball.mesh.position); - if (goalDistanceL < (this.goalL.geometry.boundingSphere.radius - ball.mesh.geometry.boundingSphere.radius)) { + if (goalDistanceL < (this.goalL.geometry.instance.boundingSphere.radius - ball.mesh.geometry.boundingSphere.radius)) { if (ball.scored === false) { console.log('left goal!'); ball.scored = true; @@ -209,7 +209,7 @@ R3.CustomCode.prototype.render = function(delta) { } } - if (goalDistanceR < (this.goalR.geometry.boundingSphere.radius - ball.mesh.geometry.boundingSphere.radius)) { + if (goalDistanceR < (this.goalR.geometry.instance.boundingSphere.radius - ball.mesh.geometry.boundingSphere.radius)) { if (ball.scored === false) { console.log('right goal!'); ball.scored = true; @@ -573,6 +573,9 @@ this.footballPlayer.instance.position.z = this.football.instance.geometry.boundi this.football.instance.position.y = this.ballY; this.football.instance.visible = false; +this.goalL.geometry.instance.computeBoundingSphere(); +this.goalR.geometry.instance.computeBoundingSphere(); + R3.Event.Emit(R3.Event.GAME_LOADED); //@ sourceURL=entityLoaded.js