我想在Facebook上制作像指南针一样的指南针: Click here for image
FOV(指南针中间的切片)将根据相机的FOV旋转。我有相机的x,y和z旋转,但我想知道如何将其转换为二维圆视图?此外,three.js相机的y旋转仅从-PI / 2变为PI / 2
非常感谢任何帮助:)
答案 0 :(得分:3)
使用THREE.Spherical()
解决了同样的问题var vector = new THREE.Vector3();
var center = new THREE.Vector3();
var spherical = new THREE.Spherical();
vector.copy( camera.position ).sub( center );
spherical.setFromVector3( vector );
var rot = spherical.theta;
$('#compassSVG > svg')[0].style.transform = 'rotate('+ rot +'rad)';