Ludovico

I'm trying the new animation sample from microsoft!

Code looks pretty good, I compiled it and everything goes well, a nice man walking appear on my screen!

Then i tryied to change the model.. I took tiny.X, from the directX sdk, and added it to the project.

When i run the application an exception is thrown here:

// Look up our custom skinning information.
SkinningData skinningData = currentModel.Tag as SkinningData;

if (skinningData == null)
throw new InvalidOperationException
("This model does not contain a SkinningData tag.");


This seems strange, because Tiny.x is part of the directX sdk!

So I opened 3ds max and created a simple cylender with 2 bones. Exported It to .FBX, loaded in my application, and I have encountered the same problem!

I cannot debug the content processor with visual C# express, so I can't understand why this thing happen.

Someone has encountered my same problem Anyone has an idea on how to solve this



Re: XNA Game Studio Express Problem with new Animation sample

Shawn Hargreaves - MSFT

Are you sure you selected the custom animating model processor when you added tiny.x to your project

By default it will just pick the default ModelProcessor, so you'll have to change that to specify you want to use the animation system.

I definately tested that code with Tiny, so I'm pretty confident she works with it (although she'll probably come out the wrong way up and a silly size, since she wasn't modelled in the same units as our new dude mesh).





Re: XNA Game Studio Express Problem with new Animation sample

Ludovico

Mmh... ops

I'll try that, but I think that i miss this little thing! Sorry for the stupid question!




Re: XNA Game Studio Express Problem with new Animation sample

Toni Greco

A new animation sample from Microsoft SUPER
Where can I find this sample

Thank you
Toni





Re: XNA Game Studio Express Problem with new Animation sample

Shawn Hargreaves - MSFT

http://creators.xna.com




Re: XNA Game Studio Express Problem with new Animation sample

Toni Greco

Thank you again.
Wonderful good job.

Does it already support multiple animation tracks and tracks animation blending

Toni





Re: XNA Game Studio Express Problem with new Animation sample

rusty_bone

Shawn,

How would you recommend speeding up or slowing down animations in the skinning example. I have an idea, but I'd really like to know how you would do it.

-Matt D





Re: XNA Game Studio Express Problem with new Animation sample

Shawn Hargreaves - MSFT

You should be able to modify the TimeSpan value that you pass in to AnimationPlayer.Update.

In the sample code we just pass in a copy of gameTime.ElapsedTime, but you could pass a larger or smaller delta here to make it play back at a different speed.





Re: XNA Game Studio Express Problem with new Animation sample

Shawn Hargreaves - MSFT

Toni Greco wrote:
Thank you again.
Wonderful good job.

Does it already support multiple animation tracks and tracks animation blending

Toni


Not directly, but we kind of built it with the idea in mind that people might want to add that stuff.

If you look in the AnimationPlayer class, you will notice that the Update method just calls three helpers in order:

UpdateBoneTransforms();
UpdateWorldTransforms();
UpdateSkinTransforms();

These are all public, and the arrays of matrices that they manipulate are also public, so you have a lot of flexibility to mix the sample code up in different ways.

For instance, you could create several AnimationPlayer instances, each playing a different AnimationClip. Instead of just calling Update on them, you could call UpdateBoneTransforms to extract the current clip keyframes, then manually blend between those keyframes to update the bone transforms array of a third animation player, before calling UpdateWorldTransforms and UpdateSkinTransforms on that third player to extract the final matrices you can use for rendering.

Or if you wanted to do inverse kinematics to make a character turn their head, you might want to call UpdateBoneTransforms and UpdateWorldTransforms, then go in and modify the head rotation matrix (in world space) before calling UpdateSkinTransforms.





Re: XNA Game Studio Express Problem with new Animation sample

rusty_bone

Shawn,

I ended up doing this bit of code in the UpdateBoneTransforms function:

time = currentTimeValue + TimeSpan.FromTicks(time.Ticks / timeScale);

I also am scaling model size with this code in the UpdateWorldTransforms function:

worldTransforms[0] = boneTransforms[0] * rootTransform * Matrix.CreateScale(modelScale);

Everything is working great. You guys are making dreams come true. Thank You.





Re: XNA Game Studio Express Problem with new Animation sample

Toni Greco

Thank you for these good ideas Shawn, I will try it.
Just last question: how can I load all the AnimationSets from one X file to use them for animations tracks

Toni





Re: XNA Game Studio Express Problem with new Animation sample

Shawn Hargreaves - MSFT

I think (am about 99% sure) they will all be imported already. The sample is just playing the first animation clip it encounters, but I think they will all be imported into the clips dictionary.





Re: XNA Game Studio Express Problem with new Animation sample

rusty_bone

I was able to load a .x with multiple animations, and it did pick up all of the clips.

I used the Psionic Ninja, which just had one huge animation, and copied/paste the animation renaming it, and then was able to call both from code.





Re: XNA Game Studio Express Problem with new Animation sample

Nightshape

Would it be possible for you to pass along the information in regards to how the dude mesh was modeled, which program, exporter etc... I've had alot of problems getting mesh with bones from 3ds Max 7.0 into either .X or FBX format.




Re: XNA Game Studio Express Problem with new Animation sample

Toni Greco

Super, this is a good news, can you post how you do this rusty_bone

Toni