如何沿椭圆路径动画和对象[Three.js]?

时间:2017-01-26 03:24:28

标签: three.js

我正在尝试沿特定椭圆移动Object3D组。我使用它成功地移动了一圈:

group.position.x = Math.cos(toRadians(loc+=5)) * radius;
group.position.z = Math.sin(toRadians(loc+=5)) * radius;

但是,我希望它遵循特定的三维椭圆。我在这里成功并可视化椭圆:

curve = new THREE.EllipseCurve(0,0,80,60,0,toRad(360),false);
path = new THREE.Path( curve.getPoints( 2000 ) );
var geo = path.createPointsGeometry( 50 );

ellipse = new THREE.Line(
    geo,
    new THREE.LineBasicMaterial( { color : 0xff0000 } ) 
);
DISPLAY.scene.add(ellipse);
ellipse.rotation.x=toRadians(94);
ellipse.rotation.y=toRadians(12);

我试着像这样动画(在我的'渲染'功能之外):

var pathAnim = new PathAnimation(group, path, 0.4);

或者甚至是这样:(在渲染功能中)

group.position=path.getPoint(t+=0.01); //i've tried getPoints, getPointAt, etc..

它似乎不起作用。关于如何让这个工作的任何想法?感谢

0 个答案:

没有答案