Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add camera to scene? #1046

Closed
chrismo opened this Issue Jan 8, 2012 · 9 comments

Comments

8 participants

chrismo commented Jan 8, 2012

A number of the examples do scene.add(camera), but a number of them don't. What's the use case for doing so?

kor86 commented Jan 8, 2012

The camera will be added automatically if you don´t add it to the scene. I believe when you´re using only one camera it´s ok but if you´re using more then one you should at them.

Owner

mrdoob commented Jan 8, 2012

Until recently the camera wasn't part of the scene graph. Because of that most of the example never add it to the scene so we do that automatically if the camera has no parent. Now a camera can be part of the scene graph, meaning that can be a child of an object. Imagine having a car on your scene and you want to put a camera on it.

Contributor

chandlerprall commented Jan 9, 2012

Since not adding a camera to the scene is deprecated shouldn't all of the examples add the camera regardless?

Contributor

alteredq commented Jan 9, 2012

They already do:

36b8839

@mrdoob mrdoob closed this Jan 9, 2012

ekunuke commented Oct 31, 2012

I'd just like to note that the README's copy+paste example does not add the camera to the scene. It only caused me a minute of confusion, but it might be a good idea to fix it.

Collaborator

WestLangley commented Oct 31, 2012

@egpaik As of r.50, the camera no longer needs to be added to the scene.

Contributor

scganterh commented Jan 31, 2017

@WestLangley so, what is the correct answer? What if I have more than one scene?

Owner

mrdoob commented Jan 31, 2017

@scganterh you can just do this:

renderer.render( scene1, camera );
renderer.render( scene2, camera );
Collaborator

WestLangley commented Jan 31, 2017

@scganterh You do not have to add the camera to any scene.

However, if you add a point light, for example, as a child of the camera, then you will want to add the camera as a child of the scene.

You can also add the camera as a child of another object if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment