Why should I add a camera to a scene, although I am already passing it to my render method? Every example I have seen in the repository adds the camera to the scene, e.g. weggl_geometries. But after removing scene.add( camera )
it still works...
init function
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
camera.position.y = 400;
scene.add( camera );
render function
renderer.render( scene, camera );
Why should I add a camera to a scene, although I am already passing it to my render method? Every example I have seen in the repository adds the camera to the scene, e.g. weggl_geometries. But after removing scene.add( camera )
it still works...
init function
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
camera.position.y = 400;
scene.add( camera );
render function
renderer.render( scene, camera );
Share
Improve this question
edited May 2, 2017 at 21:16
Damjan Pavlica
34.2k10 gold badges75 silver badges78 bronze badges
asked Sep 1, 2012 at 22:09
MatthiasMatthias
7,5276 gold badges57 silver badges90 bronze badges
1 Answer
Reset to default 9When you render without the camera added to the scene, it's automatically added. The point to have it in the scene is that in the more recent versions of the library you can add the camera as a child of another object (eventually animated) of the scene.
Here is some question answering from the Three.js developers https://github./mrdoob/three.js/issues/1046