Animated 3d model (FBX format) gets stuck in running animation

Started by
2 comments, last by lougv22 11 years, 12 months ago
[color=#4A4A4A]I am working on a simple third-person shooter game in XNA 4.0 Refresh and my character gets stuck in his Run animation. He takes about 2 steps and then kind of freezes for 15 seconds, then he takes another 2 steps and freezes again for 15 seconds and so on. I viewed the model in a FBX viewer for QuickTime and it did the same thing there so that leads me to think it's not something I am doing, but I can't be sure.
[color=#4A4A4A]
All the coding is done in Visual Studio 2010 Express, on a Windows 7 machine, using XNA 4.0 Refresh. I have my own custom Animation Writer and Reader.
[color=#4A4A4A]
Here is what the beginning frames of the animation look like:player_marine_Run_animation_1.png
[color=#4A4A4A]
And this is the pose that he gets stuck in for 15 seconds:
[color=#4A4A4A]
player_marine_Run_animation_0.png
[color=#4A4A4A]
I've attached my AnimatedModel class in case somebody would like to take a look at it. Anybody has any idea what the problem might be?
Advertisement
[color=#4A4A4A]Well no one seems to know the answer to this, so I am just going to post the solution I came up with. I found out that all 4 of my model's animations were imported with a duration of 12.5 seconds. I also found out that for the Run animation, the actual running part only spanned the first 1.32 seconds, the rest was him just sitting there looking like frozen in time. So what I did was simply reduce that animation's duration to 1.32 seconds and that seemed the solve the problem, i.e. he is running normally now.
[color=#4A4A4A]
This is all I had to do (in my AnimatedModel class):
[color=#4A4A4A]

// Reduce the duration of the Run animation for the Marine model, otherwise he gets
// stuck for most of it
if (modelFileName == "PlayerMarine")
_animatedModelData.Animations[1].Duration = new TimeSpan(0, 0, 0, 1, 320);
That's a pretty ugly hack/fix. What happens if every file needs a fix like that? The root problem is most likely in the FBX exporter, based on Quicktime giving the same problem. See if you can fix that.

Also, that's a really nice asset, where did you get it?
Well the thing is that I didn't export the model, I simply downloaded it from the website for a book I am reading (apress.com), so I have no way of re-exporting it or of fixing any problems there might be with the model itself.

This topic is closed to new replies.

Advertisement