This project is read-only.

Problems in playing animation in XNA

Oct 23, 2008 at 1:56 PM
hi,
i have been trying to solve this issue for a week now, but didn't find any luck.
well i have implemented my character in xna from 3dstudio max. i am using bruno's article as a reference.
my scene is building ok but when i play it it gives me following exception.

"KEYNOTFOUNDEXCEPTION was unhandelled" and it points to this line of code

 

animationController.StartClip(skinnedModel.AnimationClips[

"Idle"]);


well can any body tell me how can i get the name of my animation clip which is present in the model when i export it.
i am not a good programmer ,i am a more designer so getting the name of animation clip in xna is getting difficult.

appretiate if anybody reply asap.
regards.

 

Oct 23, 2008 at 11:36 PM
What did you name the Take?

Each animation in a FBX file is referred to as a Take and be default is exported from 3ds max as Take001, Take002, etc.

Its possible you're trying to reference a Take that doesn't exist in your FBX file but that's just a guess.

- Neal
Oct 25, 2008 at 1:35 PM
hi ,
well thanks a lot for replying, atleast i got some response after waiting a long time.
well i have tried naming my clips Take001 002, but unfortunately it didn't work.

well can u plz tell me how can i name the take by myself. and if possible how can i get the names of animation clips inside my model.

yeah you r right, the problem is i am naming the wrong clip which doesn't exist in the dictionary, i am trying to find the name of my clip which is exported when i export my model in fbx format but can't able to get the name of the clip.

hoping to hear from you soon.
regards.

--- On Thu, 10/23/08, nealalpert <notifications@codeplex.com> wrote:

> From: nealalpert <[email removed]>
> Subject: Re: Problems in playing animation in XNA [xnanimation:38337]
> To: [email removed]
> Date: Thursday, October 23, 2008, 6:36 PM
> From: nealalpert
>
> What did you name the Take?
>
> Each animation in a FBX file is referred to as a Take and
> be default is exported from 3ds max as Take001, Take002,
> etc.
>
> Its possible you're trying to reference a Take that
> doesn't exist in your FBX file but that's just a
> guess.
>
> - Neal
>
>
>
Oct 25, 2008 at 4:28 PM
Neal,

thanx mate, you were right by default 3dmax was giving the name Take 001 to my animated clip, thats y i was naming it wrong.
well now i have another problem i can see my animation playing but its proper distorted and all over the place.
well infact i can't even see my model properly in centre of the screen.


please tell me any advise.
regards.
sachi.
Oct 26, 2008 at 2:54 AM
Edited Oct 26, 2008 at 3:03 AM
>i can't even see my model properly in centre of the screen.

I think the root bone in the model is being placed at the origin so some models will be off center.  Either that or the coords of a model in 3ds max will have an effect on the placement of the model when its imported with the XNAnimation lib.  I'm not really sure. 

You can either move the camera so you can get a good look at your model or move the model itself.  I've just been moving the camera around since I'm still adding functionality to the library before my project starts.  I'm currently trying to puzzle out how to move the model and I should have some more information for you some time this week.  Sorry but I'm fairly new to the library myself, I really wish I could be more helpful.

>i can see my animation playing but its proper distorted and all over the place.

The distorted animation could be a number of things.  If you could elaborate on the problem with the animation I might be able to be a bit more of a help as I recently had to deal with some animation issues myself.

My issue was that I was exporting a 3ds max animation as an FBX but when I loaded and played the animation the starting pose was off and the model distorted wildly when the animation was played.  In order to get it to work properly I exported the static mesh of the model in a t-pose into an FBX file, exported the animation into another FBX file, removed the take 001 of the animation FBX and placed it into the FBX file with the static mesh.  I left the first take as Take 001 and gave the take from the animation a proper name.

The take from the animation file started as:

Current: "Take 001"
    Take: "Take 001" {
        FileName: "Take_001.tak"

and became:

Current: "Jab"
    Take: "Jab" {
        FileName: "Take_001.tak" 

This seemed to solve my problem though I honestly have very little idea why the animation file that displayed the mesh in 3ds max didn't contain the necessary information to display correctly. 

My solution seems a little hackish but maybe it'll work for you.  I'm sure there's someone on the forums who has a better idea about whats going on under the hood than I do.

- Neal

Oct 27, 2008 at 7:08 PM

Neal,
thanks for the reply.

Re: i can see my animation playing but its proper distorted and all over the place.

well by saying i can see my animation playing is that there is something going on the screen but only i can see are lines which are coming closer and far. well actually my animation is quite long in which the model is dancing, it seems that animation is playing when playing the project but the model didn't look like human at all, it look like lines like some vertex are going mad or something.

also if i try your way then i have got some confusions first what you mean by "t-pose" and if you i am not getting it wrong you mean by that is to export my model without animation from 3dstudio max and then export the animation into another file. so then i will have two fbx files one with model and one with model and animation.

 

well i am kind of confused here, please can u elaborate a little. because using two fbx files is sound kind a new to me. and how can i remove the take 001 from fbx file.


Re:i can't even see my model properly in centre of the screen.

well i was trying to play with the view and projection matrix to get a good look at my model but the animation remains the same whether the camera is far or close to the model. well i don't know how to move the camera.

 

Oct 28, 2008 at 5:52 PM
Neal,

RE: I can't see my model in centre of the screen.

well now i can see my model in the centre of the screen well all i have done is make sure that when i export the model from 3dmax its properly centeralized.