[英]Three.js Camera is focusing Only at Origin
I have drawn a path(line) around the origin, i want to move the camera along with line. 我已经绕原点绘制了一条路径(线),我想将摄像机与线一起移动。 But the camera is always facing towards the Origin.
但是相机始终面向原点。 But as per my Project specification i have to travel along the continuation of the line.]
但是按照我的项目规范,我必须沿着这条线的延续。]
camera is travelling(camera.Position.set(x,y,z) from A to B in a correct way. but when it is traveling from B to C and C to D etc , camera is facing origin not the Line.My requirement is camera should focus the line not the origin. 相机以正确的方式从A行驶(camera.Position.set(x,y,z)从A到B.但是当相机从B行驶到C和C到D等时,相机朝向原点而不是Line。相机应该对焦于线而不是原点。
Make sure you don't have something like this in your code: 确保您的代码中没有这样的内容:
camera.target = new THREE.Vector3(0,0,0);
...
function render(){
...
camera.lookAt(camera.target);
...
}
In that case upon reaching point B you should make point C a new camera target. 在这种情况下,到达B点后,您应该将C点设为新的摄影机目标。
camera.target = pointC.position.clone();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.