2013-12-22 116 views
3

那里,我该如何将我的相机移动到three.js中?我的意思是,比如,我有一条“道路”,例如,我用搅拌机制作了很多道路的模型,我想用three.js加载它,并且我想沿着道路移动摄像头,那么可以我做?你能给一些简单的代码吗?谢谢。如何在three.js中移动相机?

+1

关注此链接http://threejs.org/examples/webgl_geometry_extrude_splines.html – DPH

+0

感谢您的回复。 – Telerik

回答

0

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

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