【问题标题】:How to move the camera in three.js?如何在three.js中移动相机?
【发布时间】:2013-12-22 15:50:54
【问题描述】:

那里,我如何在three.js 中移动我的相机?我的意思是,场景我有一条“道路”,例如,我在搅拌机中制作了许多道路的模型,我想将它加载到三个.js 中,我想沿着道路移动相机,那么什么可以我愿意?你能给出一些简单的代码吗?谢谢。

【问题讨论】:

标签: three.js


【解决方案1】:

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

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();
}

或者你可以try using TWEEN.js

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-25
    • 2013-03-17
    • 2018-09-03
    • 1970-01-01
    相关资源
    最近更新 更多