I am working on a tutorial that can be found at this link: https://tympanus.net/codrops/2016/04/26/the-aviator-animating-basic-3d-scene-threejs/
During the process, I encountered an error message:
Uncaught TypeError: Cannot read property 'propeller' of undefined;
The code snippet in question looks something like this:
function loop(){
airplane.propeller.rotation.x += 0.3;
sea.mesh.rotation.z += .005;
sky.mesh.rotation.z += .01;
updatePlane();
renderer.render(scene, camera);
requestAnimationFrame(loop);
}
I attempted to make some modifications like so:
function loop(){
var airplane;
airplane.propeller.rotation.x += 0.3;
sea.mesh.rotation.z += .005;
sky.mesh.rotation.z += .01;
updatePlane();
renderer.render(scene, camera);
requestAnimationFrame(loop);
}
or
function loop(){
var airplane = new airplane();
airplane.propeller.rotation.x += 0.3;
sea.mesh.rotation.z += .005;
sky.mesh.rotation.z += .01;
updatePlane();
renderer.render(scene, camera); //START THE ANIMATION,
requestAnimationFrame(loop);
}
However, these changes did not resolve the error; What could I possibly be overlooking here?