Three.js: How to ROTATE a camera?

Created on 6 Nov 2011  路  10Comments  路  Source: mrdoob/three.js

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.

Question

Most helpful comment

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.

All 10 comments

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.

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

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

hi,

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

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

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

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

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

@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

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

Was this page helpful?
0 / 5 - 0 ratings