I love these long Url’s
If you check the JavaScript console, you’ll see:
Uncaught TypeError: Cannot read property 'addEventListener' of undefined
at VM59 code.html:152
We try to define goal
up on line 35:
var goal = addGoal();
But… it does not actually assign goal
because the addGoal()
function does not return a value:
function addGoal() {
shape = new THREE.CubeGeometry(100, 2, 100);
cover = new THREE.MeshNormalMaterial({wireframe: true});
var goal = new Physijs.BoxMesh(shape, cover, 0);
goal.position.y = -50;
scene.add(goal);
}
You have everything perfect in that function. It is only missing a return value, which you should add at the bottom of the function:
function addGoal() {
shape = new THREE.CubeGeometry(100, 2, 100);
cover = new THREE.MeshNormalMaterial({wireframe: true});
var goal = new Physijs.BoxMesh(shape, cover, 0);
goal.position.y = -50;
scene.add(goal);
return goal;
}
With that, it should work.
-Chris