Sign in to follow this  
lougv22

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

Recommended Posts

lougv22    392
[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]
[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]
[color=#4A4A4A]
Here is what the beginning frames of the animation look like:[img]http://i1109.photobucket.com/albums/h427/lukegf22/player_marine_Run_animation_1.png[/img][/color]
[color=#4A4A4A]
And this is the pose that he gets stuck in for 15 seconds:[/color]
[color=#4A4A4A]
[img]http://i1109.photobucket.com/albums/h427/lukegf22/player_marine_Run_animation_0.png[/img][/color]
[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?[/color]

Share this post


Link to post
Share on other sites
lougv22    392
[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]
[color=#4A4A4A]
This is all I had to do (in my AnimatedModel class):[/color]
[color=#4A4A4A]
[CODE]
// 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);
[/CODE][/color]

Share this post


Link to post
Share on other sites
hupsilardee    491
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?

Share this post


Link to post
Share on other sites
lougv22    392
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this