   AnimationKeys in DarkMatter
  I have started using x-files, and am a little confused with the animation keys.I presumed that animations for walking, etc. would 'wrap-around', but in a lot of the x-files (in DarkMatter for example) the first and last AnimationKey differs. Are these files badly made or do the animationkeys not cycle in this way? I have tried to use the DirectX viewer to see how the animations should look, but they don't seem to behave correct in the viewer. Are they being displayed too fast? I tried to slow things by changing the AnimTicksPerSecond value which has made them look a little better but still really jerky.I am not using DirectX and am just after details of how to animate x-files correctly using the anination keys.Thanks in advance to anyone able to give me some pointers.CheersMatt   
Quote:the first and last AnimationKey differs.First, there isn't a "standard" for animated x-files. Whoever creates the file from some modeling program decides what frames are exported.A looped animation of "n" keys, when it is at a position between n and n+1, can be written to interpolate between key "n" and key 0. If the application displaying it assumes the keys loop in that manner, and if the last and first keys are the same, the animation will "freeze" during the transition between the last and first keys.But why store more info in the x-file than is necessary? If the first and last keys are the same, it's a waste.However, you can write your interpolator to revert to key 0 when the position is incremented past either n-1 or n, depending on how your x-file is set.;  Thankyou Buckeye.I thought about interpolating from the last to first, but over what time?do I use the period between the previous keys? Do I use the mediam/average keyframe timespan? You said there is no 'standard' x-file, but surely there is some kind of standard approach to interpreting the animation. My problem is that I am writing a program to convert the x-file into a different format so I need to get it right (or as close as) first time.Cheers, Matt;  Actually, that's a really good question, Matt. I hadn't really thought it through that far.When I create animations that I expect to loop, I set the keyed parameters in last key frame plus one the same as those in the first key frame. That is, if I expect to export an animation of 40 frames, I set the keys in frame 41 the same as frame 1. I "smooth" the animation as desired and export just 40 frames. It seems to provide a good transition from last to first frame. I use the DirectX animation controller.However, looking at several x-files which I didn't generate myself, I see, as you observed, that some have last=first and others have last != first. For instance, several of Microsoft's tiny.x animationsets have first=last, which strongly implies that Microsoft thinks first=last is the way to go. It appears those are looped animations.It occurs to me that those x-files for which first != last are not intended to be looped, but are intended as transition animations only - perhaps like "draw weapon." Drawing a weapon would not be looped but would be a transition from "weapon-not-drawn-idle" to "drawn-weapon-idle" or something similar.Sounds like your best bet would be to output your format consistent with whatever x-file you're converting.   ;  Im not sure whether you have the DarkMatter (vol1) media pack, which is great (considering the models are royalty free), apart from this animation issue. In the 'people' folder, all .x-files are clearly labeled as so: person-move.x, person-attack. person-die, etc. Like you said, files such as person-die would not be expected to loop, but in the case of the person-move files, its fairly obvious (from the walking motion) the animations were intended to be looped -yet some are F = L and others not.Ive decided to interpolate f->l using the average key timespans on the offending models till myself or someone comes up with a better/correct way.I was wondering if anyone knows of a better viewer (in terms of animation) than the Directx viewer where I could examine animations in detail. Something with a speed control would be great...