Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to ROTATE a camera? #730

Closed
namiwang opened this issue Nov 6, 2011 · 10 comments
Closed

How to ROTATE a camera? #730

namiwang opened this issue Nov 6, 2011 · 10 comments
Labels

Comments

@namiwang
Copy link

namiwang commented Nov 6, 2011

hi,
I'm a newer for THREE.js,and also a newer for 3d engine.

I recently found that,the rotate method of camera disappeared,
so my old codes don't work now,
I found a new method but not exactly know how to use it,

so,How to rotate a camera,by degree or radius,for now.

thanks a lot.

p.s.
nice to meet everyone here,it's such a perfect engine,
but there're just very few documents,articles or courses in Chinese,
I'm doing some translate works, and start writing an introduce,
any suggestion will be helpful.
thanks again.

@mrdoob
Copy link
Owner

mrdoob commented Nov 6, 2011

If you're talking about the removal of camera.target what you need to do now is camera.lookAt( scene.position ) or any other point you want the camera to look at in the render loop.

Otherwise, if it's just rotating the camera, you can easily do camera.rotate.y = 90 * Math.PI / 180. Math.PI / 180 converts a degrees into radians.

@namiwang
Copy link
Author

namiwang commented Nov 6, 2011

Thanks,but,
camera.rotation,right?
thanks again.

@mrdoob
Copy link
Owner

mrdoob commented Nov 6, 2011

Oh yes, sorry... camera.rotation.y = 90 * Math.PI / 180 ^^

@ghost
Copy link

ghost commented Nov 18, 2015

hi,

why when I use camera.rotate.x = 90 * Math.PI / 180; I've a error : Uncaught TypeError: Cannot set property 'x' of undefined

@mrdoob
Copy link
Owner

mrdoob commented Nov 18, 2015

@Traacy it's camera.rotation.x. please, use stackoverflow for help.

@ghost
Copy link

ghost commented Nov 18, 2015

yes it's camera.rotation sorry. I used it but it doesn't turn

@dyh333
Copy link

dyh333 commented Mar 6, 2017

@ghost, i met the same problem, have you solve it ?

@RaineGit
Copy link

@dyh333
yes, you can use
camera.rotation.y +=

@mikejernil
Copy link

@mrdoob @MC41Games I used camera.rotation.y += 90* Math.PI/180. Doesn't seem to turn. Can you help me out?

Also tried rotation.set
& camera.lookAt(with camera.up)
new

@mrdoob
Copy link
Owner

mrdoob commented Nov 19, 2019

Please, use https://discourse.threejs.org/ for help.

Repository owner locked and limited conversation to collaborators Nov 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants