Distorted Animation

Jul 12, 2009 at 1:42 AM

Hi all,

I am working on putting an animation to XNA Game Studio 3.1 using XNAnimation 0.7 BETA2 .

The result is :
http://img8.imageshack.us/img8/2440/3dsx.jpg

And the 3D Studio Max is look like this :
http://img50.imageshack.us/img50/5729/clipboard01r.jpg

First , I grab the source code of XNAnimation 0.7 BETA2 and recompile it against XNA Game Studio 3.1.
The step generates no problem.

Then, I export my character in 3D Studio Max 2009 using Autodesk FBX Exporter 2010.0.2 .
Settings are as follow:

Preset : User Defined
Animation : Enabled
- Bake Animation : Enabled
-- Start : 0
-- End : 100
-- Step : 1
- Deformation : Enabled
-- Skins : Enabled
-- Morphs : Enabled
- Curve Filters : Disabled
- Use scene name  : Disabled
- Point Cache File(s) : Disabled

Bind Pose : Enabled <-- I call this out from Edit mode
Cameras : Disabled
Lights : Enabled
Embed Media : Disabled

Split-by-vertex per normal : Disabled
Tangents and Binormals : Disabled
Convert Geometry used as Bones : Enabled

Units : Inches

Up Axis : Y-up

Show Warning Manager : Enabled
Generate Log Data : Enabled
Show UI : Enabled

FBX File Format
Type : Binary
Version : FBX201000

Next, I import my MAX file into my project's content folder, configure it using XNAnimation Content Processor

Then, it is the programming codes:

Global Variables:
SkinnelModel rSM;
AnimationController rAC;
float nearPlaneClip = 1.0f;
float farPlaneClip = 10000.0f;
Matrix viewMatrix, projMatrix;
Vector3 rPos = new Vector3(-100.0f, 50.0f, 0.0f);

in LoadContent :

rSM = content.Load<SkinnedModel>("mesh/r_animate01");
rAC = new AnimationController(rSM.SkeletonBones);
rAC.StartClip(rSM.AnimationClips["Take 001"];

 

cameraPosition = new Vector3(200.0f, 0.0f, 1000.0f);
aspectRatio = ScreenManager.GraphicsDevice.Viewport.AspectRatio;
viewMatrix = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
projMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, nearPlaneClip, farPlaneClip);

in Draw :

ScreenManager.GraphicsDevice.Clear(Color.CornflowerBlue); // i got a ScreenManager to handle screen objects
Matrix[] tR = new Matrix[rSM.Bones.Count]; rSM.CopyAbsoluteBoneTransformsTo(tR); foreach (ModelMesh modelMesh in rSM.Model.Meshes) { foreach (SkinnedModelBasicEffect effect in modelMesh.Effects) { // Set the animated skeleton from the animation controller effect.Bones = rAC.SkinnedBoneTransforms; // Set the camera effect.View = viewMatrix; effect.Projection = projMatrix; // OPTIONAL - Configure material and light effect.Material.DiffuseColor = new Vector3(0.8f); effect.AmbientLightColor = new Vector3(0.2f); effect.LightEnabled = true; effect.EnabledLights = EnabledLights.Two; effect.PointLights[0].Color = Vector3.One; effect.PointLights[0].Position = new Vector3(100); } modelMesh.Draw(); }

 

in Update:

rAC.Update(gameTime.ElapsedGameTime, Matrix.Identity);

 

 

The question I want to ask is :

How can I fix this problem ??

Sep 15, 2009 at 8:23 AM

in case its not too late: http://xnanimation.codeplex.com/Thread/View.aspx?ThreadId=58567 ;)