jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
942 stars 188 forks source link

manipulate camera bound to orbit controls #166

Closed mzhng closed 6 years ago

mzhng commented 6 years ago

Is it possible to manually update the position and rotation of a camera that is bound to an instance of OrbitControls? I believe in the original threejs implementation, one can call controls.update() after updating the camera to make it work properly, but it seems the update method is not available in pythreejs.OrbitControls. I can update the camera's attributes and see the change in the displayed scene, but when I click on it, it seems the orbit controls take over again and reset all changes I applied to the camera.

vidartf commented 6 years ago

For version 1 beta: Normally you would do this via camera.quaternion or camera.rotation. There are also the utility functions rotateX/rotateY/rotateZ, lookAt and setRotationFromMatrix. Again, these are all on the Camera instance.

For older: You can manipulate camera.quaternion, or use the utility function quaternion_from_rotation or look_at.

Does this answer your question?

vidartf commented 6 years ago

Closing as answered.