Animation interpolation

Animation interpolation

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Animation interpolation

Post by Sean Mirrsen »

Or whatever it's called.

I know OTA units have their scripts smoothed out by detecting series of move..now and turn..now commands followed by a sleep command, and making smooth animations based on those. The question is: how do I make it work on my own units? I simply need to sync together a lot of motion for my 6-legged Drone units, and it would be a lot easier through the use of sleep-delimited animation frames.
User avatar
Buggi
Posts: 875
Joined: 29 Apr 2005, 07:46

Post by Buggi »

methinks animation should be more bone-based than object based, but that's an INSANE amount of work.

*/methinks*
User avatar
RightField
Posts: 110
Joined: 11 Nov 2004, 21:29

Post by RightField »

As far as I know, the interpolation is automatic. Just script it like you would script a normal TA unit, and it will smoothen out.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

That's the problem - it isn't! I tried to experiment, made a simple framed animation - and the frames remained as frames, no interpolation whatsoever. Maybe they only are interpolated in specific scripts? I'll try it later.
Fnordia
Former Engine Dev
Posts: 425
Joined: 13 Aug 2004, 16:11

Post by Fnordia »

There's no specific script checking for the interpolation, it is done for every script. I can take a look at your script and see if there's anything that could cause it to not interpolate if you want.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

I'm scared that doing that interpolation for every units will mess many carefully crafted scripts.

What exactly is that interpolation thing doing? How does it ensure its changes are harmless?
Fnordia
Former Engine Dev
Posts: 425
Joined: 13 Aug 2004, 16:11

Post by Fnordia »

It basically works like this: When a move-now or a turn-now command is detected, it is saved to a list of delayed animations, instead of updating the piece coordinates directly. When the script is finished, if the script finished because of a call to sleep with a 30 < sleeptime < 300, these delayed animations are translated into interpolated ones for the duration of the sleep. Otherwise the values are updated directly.

The following checks are made to make sure these interpolatations are transparent: If a move/turn on the same piece and axis is done later during the same tick, the delayed animation is commited first. Also, an interpolation is not allowed to overwrite a turn or move in progress (unless it originated from a previous interpolation), if one is running the values are updated directly instead.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Ah, I see. That's what the problem is. My scripts are usually slower than that, using about 500 microseconds per frame. Can you change that in the code, so that it is more flexible?
Post Reply

Return to “Engine”