javascript - Reasons for adding a camera to a scene in Three.js? - Stack Overflow

Why should I add a camera to a scene, although I am already passing it to my render method? Every examp

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
Add a ment  | 

1 Answer 1

Reset to default 9

When 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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744407480a4572706.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信