• Advertisement
Sign in to follow this  

rotation animation and deltaT?

This topic is 1474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I've made a nice animation including camera movement and rotation per frame.

While 'recording' the animation, I've saved the changes in position absolute (divided by time delta). So when I play the animation, I multiply by delta time, so on different hardware it runs as it should/ I want it to.

 

But when I run my animation on another machine, the result is terrible.

Both the movement looks strange, and the rotations don't seem to be OK.

So I have 2 questions:

- is my approach on recording and playing the animation OK, for movement?

- should I also multiply the rotations by time delta, if so, would I also have to 'save' them absolute, divided by time delta

Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
While 'recording' the animation, I've saved the changes in position absolute (divided by time delta).

 

 

You mean by the frame time?

 

Save the keyframes in miliseconds. 

Interpolate between keyframes using time diff. and passed time.

Share this post


Link to post
Share on other sites
Thanks. I've been thinking about it a bit longer and think I draw the same conclusion.

- change the movement and rotation data to absolute values instead of changes in movement/rotation
- based on passed time (deltaT) go no next frame or skip 1 or more frames, depending on the actual fps

If I keep my animation using changes instead of absoute positions/ rotations my animation gts messed upwhen I skip frames.

Atthe moment the animation is saved based on 50 frames per second. I have done quite some work within the timeline of the anmation, thats why I'll check which frame to go to, based on 1sec/50.

Are those assumptions right/ would this approach work?

Share this post


Link to post
Share on other sites

Simply skipping keyframes is at least a sub-optimal solution. The correct way is this:

 

1.) The animation has a duration of T seconds. It stores its values at discrete key times ki in [0,T].

2.) At game time t0 the animation should start. The instance of animation hence runs from t0 to t0+T. Mapping from game time to animation time hence requires to subtract t0.

3.) Rendering the animation is done at several time steps ti within [t0,t0+T]. For a given ti you look up the kn and km with kn being the greatest key time less than or equal to ti - t0, and km being the lowest ke time greather than or equal to ti - t0

4.) Compute the fraction f := ( ti - t0 - tn ) / ( tm- tn ) if the denominator is not zero.

5.) Interpolate the animation values belonging to kn and km using f.

Edited by haegarr

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement