How can i change the speed of an animation?

I have tried setting the “fps” parameter in the .qc file to a really low value, and it didn’t work. Then i tried scaling the animation so it had more frames, and it didn’t work. Last but not least, i tried using SetPlayBackRate and (oh surprise!) it didn’t work.

The weirdest thing is that in HL model viewer it works perfectly,. So, can anyone help me out with this?

It’s really a combination of frames-per-second and the amount of frames. If you have 100 frames at 30fps, it would take 3.33 seconds for the animation to play fully.

Ideally, you should keep the fps between 25 and 35, as well as remove certain frames entirely.

If you had 100 frames and you wanted to make it play 10% faster, you would delete a frame every 10 frames, meaning games numbered 11, 21, 31, 41, 51, 61, 71, 81, 91.

See if doing any of these works for you.

Sadly it doesn’t, i know this because my animation has 200 frames at 30fps and it takes way less than a second to play it. See it for yourself:

I can’t watch the video because I’m not at a computer, so I’ll get back to you when I can.

Are the frames numbered correctly, going from 0 to 200?

Yep. In fact, that animation is divided into 5 keyframes on the 0, 50, 100, 150 and 200 frame each.

The last keyframe should animate the landing gear hatches AFTER the gear is fully retracted, but if you look closely you can see that they close while the landing gear is still raising.

Btw i’m using $sequence instead of $poseparameter por $animation if that has something to do with my problem.

Try changing $sequence to $animation, I read that $animation is better for “complex” models, which can be assumed for yours.


What class is the part of the plane with the wheels or is the plane a whole model?

I remember, if i tried to play a animation on a prop with lua, then i can try everything i want, i can’t change the animation-speed, if i use in the qc file the command $seqeunce.
Only if i spawn the wheels as extra prop with class “prop_vehicle_prisinor_pod” and a keyvalue that the “vehicle” is locked, then i can change the speed of the animation.

Oh and btw, if the mechanism make problems, that parts clip in each other, then use a linear-animation not a non-linear. :slight_smile:

I hope i could somehow help!

Not sure what you really want to do, but I’m assuming you want to slow down the animation, right ? If so, changing ‘fps’ value to a lower one should work fine.

I hate to bring this up, but are you sure you are actually exporting all 200 frames and not just the key frames? Because there’s literally no way your properly exported sequence is going to ignore whatever fps value you give it and play it at hyperspeed.

Next thing I was going to suggest him is to open the .smd animation file with notepad and check how many frames are there. There must be something wrong with the exporting.

Sorry for not answering before, i didn’t knew people where still reading this thread :v:

I’m just using milkshape to export the .smd files. First i export a rigged model of the landing gear without keyframes and use it as reference model. Then i make the animations with milkshape and export the animated models as sequences. I didn’t know it was possible to export just the keyframes, so i don’t really know what to do about that.

I will try this, but i’m not sure what i’m looking for.

EDIT: Here is the .smd of the landing gear retracting animation

Not sure if there is anything wrong in there, but I can see 200 frames, with frames 0, 50, 100, 150 and 200 being the keyframes.

Also, i started moving the landing gear hatches from frame 150 to 200, when the landing gear is fully retracted so it doesn’t clip through those hatches. But for some reason it just ignores that detail and the animation moves all the parts at the same time :confused:

About everything moving at the same time, Have you tried using $sequence with an $animation line for each keyframe? Eg, If you had keyframes at frame 0, 10, 20, and 30 then I would do this

    $animation neutral "animation" frames 0 0
    $sequence "idle" "idle" fps 30 ACT_IDLE 1	
    $weightlist landing_gear { "bone1" 1.0 "bone2" 1.0 }
    $animation 1 "landing_gear_animation" frame 0 0 subtract neutral 0 weightlist landing_gear
    $animation 2 "landing_gear_animation" frame 10 10 subtract neutral 0 weightlist landing_gear
    $animation 2 "landing_gear_animation" frame 20 20 subtract neutral 0 weightlist landing_gear
    $animation 4 "landing_gear_animation" frame 30 30 subtract neutral 0 weightlist landing_gear
    $sequence landing_gear { 1 2 3 4 blend landing_gear 0 1 blendwidth 4 } weightlist landing_gear delta autoplay

I tried that with poseparameters, and i think it didn’t work. Might try with sequence instead, but the animation speed problem is still there :confused:

If i remember correctly, the wings and the tail are separate entities, so i guess that could be the problem. But i don’t know how to fix that, because all the coding part is managed by @Hoffa

SligWolf the parts are all scripted ents with anim baseclass so they have the animation stuff but the speed issue is weird because I doubt that function was created just for that specific combination of entity and keyvalue… Using prop_vehicle_prisoner_pod is ruled out because it’s just too big of a refactor to move away from scripted ents and create external hooks to handle the flight model and everything.

Oh okay, i understand. It was just a idea. :slight_smile:
Good luck for the project!

Bumping because the latest Gmod update didn’t fix this issue (i was hoping it would :pwn:)

Bump, there must be a way of solving this.

Bump for relevance, anyone ?