美文网首页
相机追赶的实现(第三人称相机)

相机追赶的实现(第三人称相机)

作者: 不决书 | 来源:发表于2019-10-15 16:57 被阅读0次
var relativeCameraOffset = new THREE.Vector3(0,50,200);
var cameraOffset = relativeCameraOffset.applyMatrix4( MovingCube.matrixWorld );
camera.position.x = cameraOffset.x;
camera.position.y = cameraOffset.y;
camera.position.z = cameraOffset.z;
camera.lookAt( MovingCube.position );

原理是通过物体的矩阵,计算出相机的相对位置,并将相机的朝向指向物体

FYI:
https://stemkoski.github.io/Three.js/Chase-Camera.html

相关文章

网友评论

      本文标题:相机追赶的实现(第三人称相机)

      本文链接:https://www.haomeiwen.com/subject/bmdsuctx.html