three.js perspectivecamera current angle in degrees

 ̄綄美尐妖づ 提交于 2019-12-24 05:13:12

问题


For a project I use a PerspectiveCamera which gets rotated using the vrcontrols from r69. At one point I require the current viewing angle degrees (horizontal & vertical degrees at which direction the camera is looking at). How would I acquire those?


回答1:


What you want are also called euler angles. Three.js eulers have a built in function to set them from a quaternion.

var quat = new THREE.Quaternion();
var euler = new THREE.Euler();
euler.setFromQuaternion(quat);

alert('X in degrees: ' + euler.x + '\n' +'Y in degrees: ' + euler.y + '\n' + 'Z in degrees: ' + euler.z);


来源:https://stackoverflow.com/questions/26901618/three-js-perspectivecamera-current-angle-in-degrees

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!