Enhancing the Sprite lib - rotating 3d objects

Hi all,

I don’t know if this has been discussed already, but I’ve been stuck with this use case for a while, and it seems the current sprite api just doesn’t allow this.

The usecase is I have some sprite image that represents some 3d object rotating from 0 to 360 degrees. So each frame represents say +9 degree rotation.
So if I want to make that object rotate from 0 to 90 degrees, then I’d play frames say 1 to 10.

(Btw the reason it’s using a sprite for rotation is because it’s a 3d object, I know I can rotate it with obj.rotation, but this way the image needs to be shot from above and you loose the cool 3d effect)

And to do this 0 to 90 rotation, I now need to define some sprite sequence like this:
{ name=“rotate0to90”, start=1, count=10 }

Problem is that, you need to be able to do rotations like from 45 to 60 degrees, 60 to 50 degrees and so on… you can’t define all possible combinations of sequences…

I’ve tried a bunch of hacks and workarounds, but none of them work well (like defining each frame in a separate sequence, or playing all frames and pausing when it reaches the point, etc).

The way I imagined it (ideally, don’t know if it’s a good implementation) is if you could define 2 sequences like this:

{ name=“rotate0to360”, start=1, count=40, loopDirection=“forward” },
{ name=“rotate360to0”, start=1, count=40, loopDirection=“backward” },

Then if you want to rotate from 45 to 90 degrees, you play the first sequence, *but* starting from frame 5 and stopping on frame 10. Same thing backwards and this way you can program custom rotations.

I guess you can emulate the lack of loopDirection “backward” by defining all frames in the sequence from 40 to 1. But I didn’t find a way to tell it - play this sequence, starting from frame X.

What do you think, does that make sense? Or am I missing something? Because right now I don’t see a good way to do it and I’m considering the option to rotate just the 2d image (shot from above), so it’s no more a 3d object.

Cheers. [import]uid: 145398 topic_id: 28136 reply_id: 328136[/import]

Would movieclip be a good option here? There’s a (reversible) 3D cube animation in the movieclip sample code that ships with Corona that could be a good starting point. [import]uid: 52491 topic_id: 28136 reply_id: 113811[/import]

Well yeah, that worked actually. The animation is not as smooth as with the native .rotation, but I guess that’s expected. Thanks! [import]uid: 145398 topic_id: 28136 reply_id: 113835[/import]