简体   繁体   中英

Rajawali RotateAnimation3D

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.

I used the RotateAnimation3D for rotate my object in my class with below code in new version of 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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