简体   繁体   English

拉贾瓦利RotateAnimation3D

[英]Rajawali RotateAnimation3D

Using the master branch of Rajawali I can make my camera rotate around an axis using 使用Rajawali的主分支,我可以使用以下方法使相机绕轴旋转

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). 前提是我尚未设置getCurrentCamera()。setLookAt(0,0,0)。 If I do setLookAt, I get no rotation at all. 如果我执行setLookAt,则根本不会旋转。

Using the 0.9 version the equivalent would seem to be 使用0.9版本,等效的似乎是

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(). 但是无论setLookAt()如何,这似乎都不起作用。 I get no rotation at all. 我完全没有旋转。 If I change getCamera() for another object the rotation works just as I'd expect. 如果我将getCamera()更改为另一个对象,则旋转将按我的预期进行。

What am I missing with this? 我想念什么? Any help much appreciated. 任何帮助,不胜感激。

Thanks. 谢谢。

I used the RotateAnimation3D for rotate my object in my class with below code in new version of rajawali: 我使用RotateAnimation3D在我的班级中用以下代码在新版本的rajawali中旋转对象:

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

and it works for me! 它对我有用! I think you should change mObject to get currentCamera() for The desired result 我认为您应该更改mObject以获得currentCamera()以获得所需的结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM