|
|
Calculating Animation FPS Difficulty: Beginner |
| Category: CS:S > Animating | Author(s): CapnJack |

So we've all seen great releases with the most awesome looking model/skin ever right? Well here's the thing that really ruins a nice replacement for me - improperly timed animations! Improperly timed animations result in an animation not being played all the way through or ending too quickly thus leaving time at the end of a sequence where the gun does not move. This problem is really annoying throwing off the player's reload timing and looks weird because your replacement gun just sits there doing nothing for a time which defeats the purpose of animating it. So here's how you fix this problem:
First off decompile Valve's model for whatever gun you are going to replace. This is always a good idea when you are replacing any skin as it is a great reference to start from. If you are replacing animations for the USP, decompile Valve's USP and then open up the SMD for the animation you want to replace in MS3D or 3DS and view the framecount in there. The default FPS for Valve's animation will be in the mdldecompiler.qc file next to the corresponding sequences.
For those of you who do not wish to read about the math involved skip to the bold yellow text below, this is the formula you will need to calculate your target FPS in a simplified version.
As an example I'm going to replace the USP silencer detach animation. The number of frames in my animation I have made is 86. The number of frames in Valve's default silencer detach animation is 116. The default framerate for Valve's animation is 37. So now we need to find out how fast we need to play our animation to match the amount of time it takes to remove the silencer in Valve's animation. To do this we use simple proportions (see picture).
- Write your animation's framecount (86) over x which will be your target framerate.
- Write the fraction from step 1 equal to Valve's framecount (116) over Valve's framerate (37).
- Cross multiply.
- Divide to get x by itself so in this case we will divide both sides by 116. 116x will cancel out to just x as a result.
- Multiply/divide out the remaining numbers to get your target framerate which is approximately 27.43 in this case.
If the math bothers you then use this easy formula:
Target Framerate = (Your Framecount x Valve's Framerate) / Valve's Framecount
Sorry for the math lesson ;).
Now apply this knowledge to the qc file the text in red is the command you should have changed:
$sequence detach_silencer "detach_silencer" ACT_VM_DETACH_SILENCER 1 fps 27.43 {
{ event 5004 29 "Weapon_USP.DetachSilencer" }
}
Please note there is only a certain level to which you can apply this. Obviously you can't stretch something like a 5 frame animation across a time of about 10 seconds otherwise it would look like it was in slow motion. |
| Added: 1 year ago | Tags: math, calculation, compiling, animation, drugs, boring |
 Add Feedback Provide constructive feedback. What is "constructive"?You cannot post yet!Get involved on FPSB by posting your thoughts. Give authors your feedback to help them develop. To post in this submission register or login. |
 You cannot assess yet!Moderating FPSB is in your hands - when you assess a submission your vote determines its success or failure. To vote on this submission register or login. This Tutorial in a nutshell... Useful & Detailed 2 x Useful 1 x Detailed 1 x Confusing 1 x Helpful 1 x Handy You cannot stamp yet!Stamps let you apply characteristics to submissions to help others understand them. To stamp this submission register or login. .LOAD "*",8,1 Want more? Find related tuts. |