Frame independant sprinting

Moderator
Posts: 133
Joined: 2008.05
Post: #1
Bear with me here, this may not make sense.

In making my track and field game(athletics to some of you sissy foreigners Smile), my athlete class has a bunch of stats that range from 1-100. Two of these stats play into how fast they are running, that is turnover(how fast your legs move) and sprintPower(how far you move when you push off).

In order for the athlete to appear to be running, I have it set up where there are animation frames in which certain body parts are rotated to certain angles. Simple stuff.

Anyway, some frames in the animation sequence have a framecode that specifies it needs to "push off", meaning the foot's on the ground and it's pushing the body forward.

What I need is, to make the running look smooth, and when the athlete hits this pushoff frame he shouldn't slide across the ground, that is the across the ground speed shouldn't be constant.

My animate code for the athlete goes something like this: get the elapsed time in, add it to the current time. It takes the athlete's turnover and does a little calculation to find how much elapsed time it needs to go to a new frame in the animation. When it goes to a new frame, it checks if it is a push off frame and if it is it finds the next push off frame in the animation, and calculates the stride length based on sprintPower and height of the athlete. While it's in between push off frames, it needs to move horizontally according to how much time has elapsed since it pushed off.

Problem is, when I do it this way, it's not giving me consistent times and the animation looks kind of choppy. Sometimes the athlete runs 10.50 in the 100m, sometimes 10.52, off by that little amount is a big deal though in track and field, so I want to find a way to stabilize it so that just letting an athlete run a race without telling him to speed up or anything gives the same time each time he runs it. Also I need to be able to make the animation smoother, any suggestions, if I didn't lose you?
Quote this message in a reply
Member
Posts: 156
Joined: 2002.11
Post: #2
Perhaps you should think the other way around. Prepare an animation of the whole running cycle with a X number of frames. Play the animation at different frame rates to get each athlete to run faster or slower. Mark the position of the athlete on the track by adding preset distance intervals for each animation frame.

So, if athlete starts at S = 0, advance it one frame to get the new S1, and so on. This way, when the animation is playing the push-off frame, you know exactly what the distance will be from the previous frame.
Quote this message in a reply
Post Reply