0

Using the master branch of Rajawali I can make my camera rotate around an axis using

mRotateAnimation = new RotateAnimation3D(axis, angle);
mRotateAnimation.setDuration(4000);
mRotateAnimation.setTransformable3D(getCurrentCamera());
mRotateAnimation.setInterpolator(new DecelerateInterpolator(5f));
registerAnimation(mRotateAnimation);
mRotateAnimation.play();

provided that I have NOT set getCurrentCamera().setLookAt(0,0,0). If I do setLookAt, I get no rotation at all.

Using the 0.9 version the equivalent would seem to be

mRotateAnimation = new RotateAnimation3D(axis, angle);
mRotateAnimation.setDuration(4000);
mRotateAnimation.setTransformable3D(getCamera());
mRotateAnimation.setInterpolator(new DecelerateInterpolator(5f));
mRotateAnimation.start();

but this doesn't seem to work regardless of setLookAt(). I get no rotation at all. If I change getCamera() for another object the rotation works just as I'd expect.

What am I missing with this? Any help much appreciated.

Thanks.

4

1 回答 1

0

我使用 RotateAnimation3D 在新版本的 rajawali 中使用以下代码在我的班级中旋转我的对象:

mAnim = new RotateAnimation3D(Axis.Y, 360);
mAnim.setDuration(16000);
mAnim.setRepeatMode(RepeatMode.INFINITE);
getCurrentScene().registerAnimation(mAnim);
mAnim.setTransformable3D(mObject);
mAnim.play();

它对我有用!我认为您应该更改 mObject 以获取 currentCamera() 以获得所需的结果

于 2014-04-12T06:58:15.990 回答