RotationTrack example

Sorry guys, but I can’t figure out how to use RotationTrack. I’m using the 01-24-2011 nightly build, and it doesn’t have any tests that I can find. I’ve tried fiddling with it, but it doesn’t seem to do anything.



Might someone with spare time please give me a piece of code using RotationTrack which I can dissect and learn from? I can post my own test code, if you like.

Look at TestCinematic, the rotation track is sued to rotate the teapot.

Tracks in general has to be used in a cinematic



the RotationTrack constructor takes the spatial you want to rotate, and array of 3 floats representing the x, y, z rotation in radians, it can take the duration, and the loop mode.



so for exemple :



float[] rotation2 = {0, FastMath.TWO_PI, 0};

cinematic.addCinematicEvent(0, new RotationTrack(teapot, rotation2, 20));



make the teapot do a complete rotation on itself along the Y axis over 20 seconds. And it starts at the beginning of the cinematic.

Thank you, nehon :slight_smile: It works perfectly, of course. I hadn’t noticed the RT being used in TestCinematic until you pointed it out.

I don’t think you can pick a custom axis to rotate around, am I right? It’s X, Y and Z, in any combination, but nothing else. Can this be changed, or can you please suggest an alternative method of rotating a mesh around an arbitrary axis, for a given number of radians, in a given length of time?

Extending RotationTrack to accept a Vector3f for the axis worked. Thanks for your previous help, nehon :slight_smile:

oops sorry forgot to answer your previous post.

Glad you found your way out of this