Comments on the Tutorial?

Topics: User Forum
Coordinator
Feb 12, 2007 at 5:15 PM
Has anyone tried the tutorial so far (up to the dwarf walking and idling)? Does anyone have any comments on it such as it being too complicated, too simple, too verbose?

Also, and this is important, has anyone got it to work? I'm not sure that the XML file will work on everyone's machine, so confirmation would be nice.
Feb 12, 2007 at 7:42 PM
Edited Feb 12, 2007 at 8:27 PM
Hi

I have tried it (without the FiniteStateMachine part, as I'm using more complex state logic) and everyting works perfectly! Fantastic work, thank you!

I have one comment though, about the way bones may be transformed: right now, your BonePose class provides the means to transform each bone individually if the animation is turned off for it. As i want to be able to move a bone over the animation's transform, i have tweaked your code to add that feature. It is a very basic tweak: only one more matrix in each BonePose instance that enables the coder to transform the bone on top of the animation's own transformation programmatically.

The revised version of your BonePose class is here.

A very very basic GSE example of this tweak's usage is here. You can use the Q and A keys to move the dwarf's arm up and down while the animation is swinging it, the Z key to reset its position and Space to switch between the idle and walk animations.
Coordinator
Feb 12, 2007 at 9:28 PM
Edited Feb 12, 2007 at 9:30 PM

Hi

I have tried it (without the FiniteStateMachine part, as I'm using more complex state logic) and everyting works perfectly! Fantastic work, thank you!

I have one comment though, about the way bones may be transformed: right now, your BonePose class provides the means to transform each bone individually if the animation is turned off for it. As i want to be able to move a bone over the animation's transform, i have tweaked your code to add that feature. It is a very basic tweak: only one more matrix in each BonePose instance that enables the coder to transform the bone on top of the animation's own transformation programmatically.

The revised version of your BonePose class is here.

A very very basic GSE example of this tweak's usage is here. You can use the Q and A keys to move the dwarf's arm up and down while the animation is swinging it, the Z key to reset its position and Space to switch between the idle and walk animations.


Cool, good to hear and thanks for the code postings. I had been considering adding this feature and had one other possible way to implement it (by storing the current frame number in the animation object). The one thing I would change is to make the AdditionalTransform a nullable matrix instead of having an extra boolean variable.

I'm also a bit hesitant to add new features because of performance. I really didn't concern myself with performance for this change set, although I did make sure that I can tweak the performance later without affecting the class structure.

However, even with me cutting a significant amount of corners in terms of performance, the library is still more limited by the hardware than the software. This is generally a good sign since most projects are limited more by software.

To summarize this rambling post, I will probably add that feature :)
Feb 13, 2007 at 6:05 AM
I'm relatively new to XNA. I went through Riemer's tutorials and am so far quite happy with some of the conveniences of this dev environment over C++ and am now wanting to do animation.

The teddy bear and lizard animation examples both compile and work flawlessly and
I went through the tutorial and got up to the DwarfFSM part. I cut and pasted the public class DwarfFSM : FiniteStateMachine block from the tutorial but I'm getting these error messages that it can't find FiniteStateMachine, ModelAnimator, or BonePoseCollection.

Error 1 The type or namespace name 'FiniteStateMachine' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\SamJew\My Documents\Visual Studio 2005\Projects\WindowsGame2\WindowsGame2\Game1.cs 22 29 WindowsGame2
Error 2 The type or namespace name 'ModelAnimator' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\SamJew\My Documents\Visual Studio 2005\Projects\WindowsGame2\WindowsGame2\Game1.cs 24 17 WindowsGame2
Error 3 The type or namespace name 'BonePoseCollection' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\SamJew\My Documents\Visual Studio 2005\Projects\WindowsGame2\WindowsGame2\Game1.cs 25 17 WindowsGame2
Error 4 The type or namespace name 'ModelAnimator' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\SamJew\My Documents\Visual Studio 2005\Projects\WindowsGame2\WindowsGame2\Game1.cs 35 36 WindowsGame2

I think these are functions in the Animation.Content.dll which I've already added to the Content Pipeline under Project. Is there something else I have to do or am missing?

Thanks to anyone who can help!
Coordinator
Feb 13, 2007 at 7:28 AM
Edited Feb 13, 2007 at 7:28 AM
You need to add:

using Animation;


At the top of your files. I'm going to try to simplify the FSM part... or if not simplify, at least have a prelude that provides an intro.
Feb 13, 2007 at 9:48 AM
Yeah, making the Matrix Nullable keeps the code cleaner, thanks. I've updated the BonePose class and the example with this modification.
Coordinator
Feb 13, 2007 at 8:31 PM
As a quick question, were you able to get the DLLs to work without recompiling?
Coordinator
Feb 13, 2007 at 8:31 PM
Edited Feb 13, 2007 at 8:32 PM
Feb 13, 2007 at 11:16 PM
Thank you for the answer but I already have using Animation; and for good measure, using Animation.Content; at the top of my code although I should have mentioned this before.

Looking at codecomplete, I can verify that it is reading those in as there appear to be a number of animation-related classes/functions: Animation, AnimatedModelProcessor, AnimationController, AnimationInterpolator, AnimationProcessor, and AnimationReader that aren't in the SpaceWar demo, for example. There's also BoneKeyFrame and BoneKeyFrameCollection. No BonePose class. There are many animation classes that begin with Model as well. (ModelAnimationBuilder, ModelBoneCollection etc.) There is not, however, a FiniteStateMachine class, BonePoseCollection, or ModelAnimator class/function, so I'm stumped as to how to proceed.

Fwiw, I'm using 1.0.0.5 of AnimationContent.dll and Animation.dll. Do I need more files than these? Will I have to attempt to compile the sources?

I might suggest that an entry-level tutorial shouldn't take advantage of finite state machines or any advanced features at all in the beginning but strips everything to the bare-bones necessities like the examples and maybe explains how to build the examples and then build on the examples, eventually working up to a dwarven FSM class.

Speaking of which, I don't see the draw code in the examples, so I'm stumped how they work. I easily managed to get the dwarf (which does walk and run but doesn't blend by replacing Diloph_model with dwarfmodel) to be an animated model. In my current project, the dwarfmodel.x geometry loads but currently there's no texture (I've tried unsuccessfully to add one) or animation, even with an AnimationController class that attempts (unsuccessfully) to mimic the code from the examples. In the bear example, it's just instantiating an AnimationController and setting the speed value so far as I can tell. Where is the draw code?

In my attempt, I've tried unsuccessfully with both cut-and-paste and updating the start frame to be 1 as the dwarf appears to do that.

In LoadGraphicsContent:

controller = new AnimationController(this, mymodel, 1);

In Update:

controller.SpeedFactor = 1f;

Presumably there's more to it than this but I don't see it. In fact, in the examples, I don't see where the textured models are being drawn! The draw code should be clearing the screen and drawing nothing so far as I can tell.

Another problem I had which I somehow mysteriously solved before but don't see how to now is that even after setting all the paths to the .dll files as in the example, the Content Importer setting doesn't
necessarily recognize X File - Animation as an option even though I somehow got it to before.

In the WalkingBear example even though the bearwalking.x model apparently walks fine with Content Importer set to X File - XNA Framework. Dwarfmodel.x returns EFAIL as corrupt or invalid when I try that. What am I doing wrong that this doesn't appear as an option and what did I do right before?

I realize that's a lot of stuff and probably even exceeds the scope of the tutorial but if someone can help point a poor confused n00b in the right direction, it would be very appreciated and would probably help make the tutorial a lot more useful as well.

Coordinator
Feb 14, 2007 at 12:26 AM
Edited Feb 14, 2007 at 12:26 AM
*smacks head*

I compiled the release version of Animation.Content.dll using the unupdated debug version of Animation.dll

I just uploaded the new dlls. Let me know if those work.

I agree with your statement about the FSM being overly for the purposes of a tutorial. I'll start it off simple and maybe put that as a more advanced tutorial.

Since ModelAnimator is a game component, the draw code is inside the class and it is automatically called by the framework. You can override this by setting visible to false and manually calling the draw method.

Your other woes seem to be caused by trying to mix and match version 1.0.0.4 and 1.0.0.5.
1.0.0.4 did not include an "X File - Animation Library" importer.
Note that the animation library is fully compatible with the default importers, but Microsoft's importer can't import the dwarf.
Feb 14, 2007 at 4:14 AM
Hi dastle,

Amazing work here. I got the dwarf working in no time and everything is running smoothly. I do have a few questions for you:

1. Where are you calling dwarfmodelanimation.xml to extract the animations? More specifically, when I create my own xml file to describe the keyframe segments that I define, where would I go about doing that?

2. Does this library only work with the .x format?

3. Is there any way to import non-bone animations for use in XNA?

4. Is your .x file modified in any way after its creation to enable its use in your animation library?

Thanks for your efforts.
Coordinator
Feb 14, 2007 at 4:34 AM
Edited Feb 14, 2007 at 4:51 AM
1. I am calling it during the build phase of the content pipeline. I was going to make a wiki on this subject soon, but here's a brief description:
- The processor will read the source file name for the model you are loading, and see if an xml file with the (same name + animation).dll exists in the directory of your model. For example, if you have a model named "bob.x", it will look for an xml file named "bobanimation.xml" in the same directory. If none exists, then it doesn't split the animation.
- If an xml file exists, then it reads it in and splits the animation accordingly.

Here is a brief summary of the XML syntax:
- To declare an animation that you want to split up, make a new <animation> node, and make a <name> node child that holds the name of the animation
- To declare a new subset of the animation, make a new <animationsubset> node, and give that a child <name> node with the name of the new animation
- There are two ways to define how you want to split the animation up into a subset. The first is to make a <tickspersecond> child of the <animation> node, and specify the <startframe> and <endframe> for each animation. This is a good way to split up .x file animations, since you can just read the "AnimTicksPerSecond" block in the .x file and set that to the value.
- The second way is to put <starttime> and <endtime> nodes inside each animation subset, and specify the start and end time for the animations.

Note that it is impossible to tell what key frame numbers you exported from your modeling program, since the pipeline passes the animation info to the processor as timed keyframes

2. It works with fbx, x, asf, amc, and bvh. But, the 3ds fbx exporter exports skeletal info different (and incorrectly) than the .x 3ds exporter.

3. The library works on non-skinned animations (and animations that don't use bones and just use mesh transforms) in almost exactly same way it does on skinned animations, provided they are in one of the previously mentioned file formats. The single exception is that when a model is loaded and isn't skinned, it is loaded with BasicEffect instead of BasicPaletteEffect. Everything else works the same.

4. The library is compatible with all .x files, unless the animation is ungodly fast. Some exporters do export the animations in "ungodly fast" mode, but if you export to ascii, this is very easy to fix by adding

AnimTicksPerSecond {
15;
}
to the .x file. I think this model already had an AnimTicksPerSecond block, though.

However, I did modify one thing in the model file because the normals were exported incorrectly. If I didn't add it, it would still load and animate, but the lighting would be off. I added this block:

AnimationLibOptions
{
1;
"RecalcNormals";;
}

This is a template that my .x importer uses because I like to set options for how to import something and not edit the code. This was one of the main reasons I made my own importer (the other is because some models seem not to work with microsofts .x importer; i have about 5 examples of that).


Coordinator
Feb 14, 2007 at 4:34 AM
Edited Feb 14, 2007 at 4:49 AM
Oh, and you are the first person that I know of to get the thing working with the dlls I uploaded. Two other people had assembly issues and had to compile the source.
Feb 14, 2007 at 7:22 PM
I got the whole thing working with your uploaded DLLs, up to the 'running dwarf' part, which I haven't tried yet. I had to hack around the animation source duration thing, by doing "crouchDown.ElapsedTime = crouchDown.AnimationSource.Duration - 1;" I see that you've fixed that today.

This has been a VERY helpful project for me. I'm trying to think of some effective way to contribute to it, but for now I'm just a consumer. THANKS!
Feb 15, 2007 at 3:33 AM
Thanks for the speedy update dastle! I'm using this library for a class project and I'd be helpless without it. I'll keep you posted on my progress.

Thanks
Feb 15, 2007 at 4:23 AM
by any chance, could you write a tutorial besides the old obsolete article on .bvh animation import?
Feb 15, 2007 at 2:17 PM
Many thanks to jnogueira for the revision and sample project.

I've basically taken your demo and tweak it further to work on the XBOX 360.

You can get it from this Link

Cheers!

Feb 15, 2007 at 3:29 PM
Thanks, the tutorial works great.

I tried a different x model than the drawf. I know this x file has animation, but I get the following error when I try to compile.

There was an error while deserializing intermediate XML. Cannot find type "Animation.SkinTransform".

I am using the Animation Library x file importer for this x file.

When I look at the XML there are two items under the Data Key="SkinTransforms". The first is a Null="true" and the second is the bone list and transforms.

Any help you could give with this error would be greatly appreciated.
Coordinator
Feb 15, 2007 at 4:37 PM

dastle wrote:
by any chance, could you write a tutorial besides the old obsolete article on .bvh animation import?

I'll get to that sometime today.
Coordinator
Feb 15, 2007 at 4:39 PM
Edited Feb 15, 2007 at 4:44 PM

dastle wrote:
Thanks, the tutorial works great.

I tried a different x model than the drawf. I know this x file has animation, but I get the following error when I try to compile.

There was an error while deserializing intermediate XML. Cannot find type "Animation.SkinTransform".

I am using the Animation Library x file importer for this x file.

When I look at the XML there are two items under the Data Key="SkinTransforms". The first is a Null="true" and the second is the bone list and transforms.

Any help you could give with this error would be greatly appreciated.



Perhaps I should be clearer about the XML file. First of all, it is optional and is only used if you want to split up an animation. Try it without the XML file first (and with both .x importers), and if it still doesn't work, then you'll have to post the model. I haven't found a model that loads in directx viewer that won't run with the library in it's current state, so this should be interesting :)

I'm a bit confused by that error as well. What is it doing trying to look for Animation.SkinTransform in an XML file? :-/
Feb 15, 2007 at 9:49 PM
Edited Feb 15, 2007 at 10:04 PM
I posted a problem I had but I found the error. I did something stupid. (declaring a variable and then redeclaring the same variable during the initialization process) Surprised the compiler didn't catch it. Anyway, thank you for your tireless devotion to helping the users.
Coordinator
Feb 15, 2007 at 10:04 PM
Edited Feb 15, 2007 at 10:05 PM
Ok, np.
Feb 16, 2007 at 10:02 AM

jnogueira wrote:
Thanks, the tutorial works great.

I tried a different x model than the drawf. I know this x file has animation, but I get the following error when I try to compile.

There was an error while deserializing intermediate XML. Cannot find type "Animation.SkinTransform".

I am using the Animation Library x file importer for this x file.

When I look at the XML there are two items under the Data Key="SkinTransforms". The first is a Null="true" and the second is the bone list and transforms.

Any help you could give with this error would be greatly appreciated.



I had the same problem. It seems that, at some point, the importer deserialises an xml file name Ur_X_file_name~0.xml or something like that, which has a list of SkinTransforms in it. The Animation.Content.dll does not have that class in it so you need to import Animation.dll as a content processor for your project as well. Go to the properties of your project, content processor tab and add Animation.dll. It should work fine
Feb 16, 2007 at 12:20 PM
Edited Feb 16, 2007 at 12:22 PM
First of all I want to say this is amazing, amazing stuff. The tutorial is great and I am excited about the library! I just went through the whole tutorial, including the optional bits. My next challenge will be to try to get it to run on the 360, and then I'm going to try importing some of my own models.

I had a few notes I jotted down while going through the tutorial.

- I had a hiccup because I tried to import all the content into a subdirectory called Media. My bad. The XNA tutorials encourage this so I thought it was a good idea. I updated the refs to the texture maps within the model, tweaked the code accordingly, and all was OK.

- On the BonePose, to turn his weapon up-side down: it may be helpful to indicate that you should include that code in the Update method.

- Similar for the blend with NodHead - which seems to work only if included in Update :)

- Little typo in the tutorial when adding the ground plane: field.x -> flat.x

- Is it just me, or does the texture on the ground not tile properly? Not a biggie of course.

- When showing how to cross-dissolve animations, the behavior of the dwarf in response to the W key (accidentally?) changes when you paste in the changes. When changing the statement in the walk state, do you mean if (keyState.IsKeyUp(Keys.W)) rather than IsKeyDown?

- In "running an animation once and using the AnimationEnded event" perhaps a propsed change to the text "Scroll down to the crouchDown_AnimationEnded that was created" -- perhaps add "by Visual Studio's AutoComplete"

I'm going to blog a link to this after I finish playing around this afternoon. My compliments on such great work!
Feb 16, 2007 at 2:24 PM


dastle wrote:
Perhaps I should be clearer about the XML file. First of all, it is optional and is only used if you want to split up an animation. Try it without the XML file first (and with both .x importers), and if it still doesn't work, then you'll have to post the model. I haven't found a model that loads in directx viewer that won't run with the library in it's current state, so this should be interesting :)

I'm a bit confused by that error as well. What is it doing trying to look for Animation.SkinTransform in an XML file? :-/



jnogueira wrote:
I had the same problem. It seems that, at some point, the importer deserialises an xml file name Ur_X_file_name~0.xml or something like that, which has a list of SkinTransforms in it. The Animation.Content.dll does not have that class in it so you need to import Animation.dll as a content processor for your project as well. Go to the properties of your project, content processor tab and add Animation.dll. It should work fine


Thanks, for your input.
What I found after following dastle's suggestion was that this particular x file had a problem. First of all, there were pleanty of Frame statements that did not have names. I edited the x file to add names to the Frame statements that did not have names. After that was done. This x file imported with two different meshes. One was assigned to the animation lib and the other was assigned to a standard XNA lib. This showed up after the model was loaded, when the effect was being set. I changed the code in the LoadGraphicsContent function to check for this.

                foreach (ModelMesh mesh in model.Meshes)
                {
                    if (mesh.Effects[0].CurrentTechnique.Name.Equals("BasicEffect"))
                    {
                        foreach (BasicEffect effect in mesh.Effects)
                        {
                            effect.View = view;
                            effect.Projection = projection;
                        }
                    }
                    else
                    {
                        foreach (BasicPaletteEffect effect in mesh.Effects)
                        {
                            effect.View = view;
                            effect.Projection = projection;
                        }
                    }
                }

I also had to make a similar change in the Update function.

            foreach (ModelMesh mesh in dwarfAnimator.Model.Meshes)
                if (mesh.Effects[0].CurrentTechnique.Name.Equals("BasicEffect"))
                {
                    foreach (BasicEffect effect in mesh.Effects)
                        effect.View = view;
                }
                else
                {
                    foreach (BasicPaletteEffect effect in mesh.Effects)
                        effect.View = view;
                }

Of course the above code assumes that the effects are not mixed on the individual meshes.

After that the model loaded and ran. It is a little too big for this project so I can only see the feet.:) I have to scale this model and try it again. Is there a good way to scale a model during the load?
Feb 16, 2007 at 7:17 PM
I just went through the tutorials and it all works perfectly for me. This is some really great stuff, you have all done a superior job! I guess the only question I have, is: for models that don't already have a weapon attached, can you give an example of attaching the weapon to the bone?
Coordinator
Feb 16, 2007 at 9:08 PM

dastle wrote:

jnogueira wrote:
Thanks, the tutorial works great.

I tried a different x model than the drawf. I know this x file has animation, but I get the following error when I try to compile.

There was an error while deserializing intermediate XML. Cannot find type "Animation.SkinTransform".

I am using the Animation Library x file importer for this x file.

When I look at the XML there are two items under the Data Key="SkinTransforms". The first is a Null="true" and the second is the bone list and transforms.

Any help you could give with this error would be greatly appreciated.



I had the same problem. It seems that, at some point, the importer deserialises an xml file name Ur_X_file_name~0.xml or something like that, which has a list of SkinTransforms in it. The Animation.Content.dll does not have that class in it so you need to import Animation.dll as a content processor for your project as well. Go to the properties of your project, content processor tab and add Animation.dll. It should work fine



Any way you can clarify this or give the model? The code does not use any XML class whatsoever in Animation.dll, so this is confusing. It has worked on all the models I threw at it. Are you making a new XML file for your own animation (should work without one)? Perhaps it is one of those dreaded build errors again (try compiling from source to see if it works).
Coordinator
Feb 16, 2007 at 9:13 PM

- I had a hiccup because I tried to import all the content into a subdirectory called Media. My bad. The XNA tutorials encourage this so I thought it was a good idea. I updated the refs to the texture maps within the model, tweaked the code accordingly, and all was OK.
- On the BonePose, to turn his weapon up-side down: it may be helpful to indicate that you should include that code in the Update method.
- Similar for the blend with NodHead - which seems to work only if included in Update :)
- Little typo in the tutorial when adding the ground plane: field.x -> flat.x
- Is it just me, or does the texture on the ground not tile properly? Not a biggie of course.
- When showing how to cross-dissolve animations, the behavior of the dwarf in response to the W key (accidentally?) changes when you paste in the changes. When changing the statement in the walk state, do you mean if (keyState.IsKeyUp(Keys.W)) rather than IsKeyDown?
- In "running an animation once and using the AnimationEnded event" perhaps a propsed change to the text "Scroll down to the crouchDown_AnimationEnded that was created" -- perhaps add "by Visual Studio's AutoComplete"
I'm going to blog a link to this after I finish playing around this afternoon. My compliments on such great work!


Thanks a ton for the feedback. The texture doesn't tile properly because I didn't manually do the texture coordinates so I just used an autotexture script with a texture that isn't meant to be tiled. I do say that you should put the optional bits in the Update method, but only after the optional parts and in the beginning of the walk part. I'll clarify that more.
Coordinator
Feb 17, 2007 at 2:02 AM
Edited Feb 17, 2007 at 6:02 AM

dastle wrote:
I just went through the tutorials and it all works perfectly for me. This is some really great stuff, you have all done a superior job! I guess the only question I have, is: for models that don't already have a weapon attached, can you give an example of attaching the weapon to the bone?


Make it a separate model, and before rendering it each frame, multiply the rotation/scale matrix of the model by the current absolute transform for the bone that you want to attach it to.

To get this, create a matrix array with size equal to the number of bones in the model, and use ModelAnimator.CopyCurrentTransformsTo. This method actually copies the absolute transforms, and is misleadingly named.
Coordinator
Feb 17, 2007 at 2:57 AM
Edited Feb 17, 2007 at 2:57 AM

Robburke wrote:
- When showing how to cross-dissolve animations, the behavior of the dwarf in response to the W key (accidentally?) changes when you paste in the changes. When changing the statement in the walk state, do you mean if (keyState.IsKeyUp(Keys.W)) rather than IsKeyDown?


Wow, I that is quite a big typo you caught there! Thanks! I bet there is at least one poor soul out there who ran into this problem and gave up :)

I ended up implementing most of your suggestions.
Feb 17, 2007 at 4:04 AM

ericc59 wrote:

dastle wrote:
I just went through the tutorials and it all works perfectly for me. This is some really great stuff, you have all done a superior job! I guess the only question I have, is: for models that don't already have a weapon attached, can you give an example of attaching the weapon to the bone?


Make it a separate model, and before rendering it each frame, multiply the rotation/scale matrix of the model by the CurrentTransform for the BonePose that you want to attach it to.


Ahh, that's what I was thinking. Thanks for clarifying that.
Coordinator
Feb 17, 2007 at 4:37 AM
Edited Feb 17, 2007 at 5:56 AM
Edit: deleted for misleading info!
Feb 17, 2007 at 5:01 AM
Sounds good.
Feb 17, 2007 at 5:15 AM

geeman wrote:
After that the model loaded and ran. It is a little too big for this project so I can only see the feet.:) I have to scale this model and try it again. Is there a good way to scale a model during the load?


I dont know if you could scale it in the load process. But it is easy to do it in the Update method. If your are using the tutorial code, just replace the following line (in the Update() method):

dwarfAnimator.World = rotation * Matrix.CreateTranslation(dwarfPosition);

By this line

dwarfAnimator.World = rotation * Matrix.CreateTranslation(dwarfPosition)* Matrix.CreateScale(0.1f); // Scale is 0.1
Coordinator
Feb 17, 2007 at 5:55 AM
Edited Feb 17, 2007 at 6:00 AM

ericc59 wrote:
Sounds good.


I'm going to doubly take back what I said before! It does work, in fact, but you'll have to use the ModelAnimator.CopyCurrentTransformsTo to get the absolute transforms. Just using the BonePose.CurrentTransform gives you the non-absolute transform.

The naming is misleading and will be changed.

I just tested it out with some cube meshes :)
Feb 17, 2007 at 9:52 AM
Cheers for making a few tweaks to the tutorial. All my suggestions were nitpicking-type stuff, but I want to point lots of people to this library, and the tutorial is the perfect way to get started with the library.

Also, I haven't gotten to the point where I am ready to contribute, but I'm going to spend the weekend trying to really understand how the Content Pipeline works. If you'd like to have one more set of eyes on the project that have seen lots of Managed DirectX, I'd love to be involved.
Feb 17, 2007 at 10:28 AM

dastle wrote:

Any way you can clarify this or give the model? The code does not use any XML class whatsoever in Animation.dll, so this is confusing. It has worked on all the models I threw at it. Are you making a new XML file for your own animation (should work without one)? Perhaps it is one of those dreaded build errors again (try compiling from source to see if it works).


I sent you the files. I was not able to reproduce the problem I was having with the x file Frame statement names, but the second problem I did reproduce.

I hope this helps.
Feb 17, 2007 at 5:21 PM
Edited Feb 17, 2007 at 5:22 PM
I have the weapon attached to the bone now as long as I run in a straight line, but if I turn and rotate the dwarf the weapon stays in the original bone's position. There must be something I am missing in the transformations but I haven't been able to figure it out yet.

Here is the code for it:
 
Matrix[] trans = new Matrix[dwarfAnimator.BonePoses.Count];
dwarfAnimator.CopyCurrentTransformsTo(trans);
 
// translate to origin
Matrix totalTrans = Matrix.Identity;
 
// rotate weapon
totalTrans *= dwarfRotation * Matrix.CreateRotationY(45f);
 
// scale weapon
totalTrans *= Matrix.CreateScale(0.05f);
 
// translate to bone and dwarf position
totalTrans *= trans[leftHandWeapon.Index] * Matrix.CreateTranslation(dwarfPosition);
 
Coordinator
Feb 17, 2007 at 7:03 PM
Edited Feb 17, 2007 at 7:07 PM
Change Matrix.CreateTranslation(dwarfPosition) to dwarfAnimator.World and you should be good to go.

You were forgetting to account for the dwarf's rotation; my name for dwarfPosition is a bit misleading.
Feb 17, 2007 at 7:20 PM
Ahh, thanks. It works perfectly now.
Feb 17, 2007 at 9:31 PM
Thanks saladinct,

Next time I will try your method, but I managed to modify x file so that my model loaded at the right size and orientation.