如何在three.js中移动相机?

如何在three.js中移动相机?,three.js,Three.js,好了,我怎样才能在three.js中移动我的相机?我的意思是,场景我有一个“道路”,例如,我在blender中制作了许多道路的模型,我想在three.js中加载它,我想沿着道路移动相机,那么我能做什么呢?你能给出一些简单的代码吗?谢谢。您可以设置时钟,更新相机的位置,并查看每次刷新 var clock = new THREE.Clock(); var increment; function animate() { delta = clock.getDelta(); incre

好了,我怎样才能在three.js中移动我的相机?我的意思是,场景我有一个“道路”,例如,我在blender中制作了许多道路的模型,我想在three.js中加载它,我想沿着道路移动相机,那么我能做什么呢?你能给出一些简单的代码吗?谢谢。

您可以设置时钟,更新相机的位置,并查看每次刷新

var clock = new THREE.Clock();
var increment;

function animate() {
    delta = clock.getDelta();

    increment += delta;

    // moves camera parallel to x axis
    camera.position.x += increment;
    camera.position.y = 100;
    camera.position.z = 200;

    render();
}

或者您也可以。

点击此链接,谢谢您的回复。