簡體   English   中英

拉賈瓦利RotateAnimation3D

[英]Rajawali RotateAnimation3D

使用Rajawali的主分支,我可以使用以下方法使相機繞軸旋轉

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

前提是我尚未設置getCurrentCamera()。setLookAt(0,0,0)。 如果我執行setLookAt,則根本不會旋轉。

使用0.9版本,等效的似乎是

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

但是無論setLookAt()如何,這似乎都不起作用。 我完全沒有旋轉。 如果我將getCamera()更改為另一個對象,則旋轉將按我的預期進行。

我想念什么? 任何幫助,不勝感激。

謝謝。

我使用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()以獲得所需的結果

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM