Jump to content

  • Log In with Google      Sign In   
  • Create Account

My time step is fixed, but...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 RobMaddison   Members   -  Reputation: 698

Like
0Likes
Like

Posted 29 January 2013 - 06:51 AM

I've used gafferongames' page regarding fixing your time step and everything looks pretty good and as expected. I was wondering though, about whether my animation processing should go inside the internal while loop or outside it.

If I put it inside, it means that I may potentially call the animation update multiple times before I render it - as calculating skeleton poses isn't cheap, this seems redundant if the renderer is only drawing the last calculated pose. If I put it outside the while loop, I only calculate the skeleton poses once (with the correct delta), but it means no matter what speed my 'physics' step is, the animation will always render at the best frame rate - this is also ok I guess, but it doesn't feel right. If it goes outside the loop and uses the delta calculated by the loop, then what sort of things are meant to actually go inside the loop?

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7471

Like
2Likes
Like

Posted 29 January 2013 - 07:46 AM

this is also ok I guess, but it doesn't feel right

But it is the right way. The physics engine needs to integrate over time, this is done by an approximation of an integral. Smaller steps will result in a better approximation, and therefore more stable behaviour. Animation on the other hand is just an interpolation between given points, your are able to define the exact interpolation at every time.


Edited by Ashaman73, 29 January 2013 - 07:48 AM.


#3 Hodgman   Moderators   -  Reputation: 30384

Like
3Likes
Like

Posted 29 January 2013 - 08:09 AM

There's multiple parts to animation -

* choosing what animations are to be layered together at what time, is gameplay code.

* IK and rag-doll are probably physics code.

* Actually evaluating the animation layers to get a posed skeleton is rendering code (and is deterministic; you shouldn't need a dt here to advance a simulation).

* Using a skeleton to skin/render a mesh is rendering code.

 

You could put the first two in your fixed-step frame loop, and the bottom two in the rendering loop.


Edited by Hodgman, 29 January 2013 - 08:09 AM.


#4 RobMaddison   Members   -  Reputation: 698

Like
0Likes
Like

Posted 29 January 2013 - 10:41 AM

Thanks both, makes sense now




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS