Sign in to follow this  

[SlimDX] Animation

This topic is 3293 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I get back to my work on Animation in SlimDX and ofcourse i have problem with it. I created CustomFrame, CustomMeshContainer and CustomAllocateHierarchy and then i loaded "tiny.x".
root = Frame.LoadHierarchyFromX(Device, "tiny.x", MeshFlags.Managed, new CustomAllocateHierarchy("tiny.x"), null, out ac);
It works fine. I can get BoundSphere etc. I can render my loaded object too
protected void RenderFrame(Frame frame, Matrix parentTransformationMatrix)
        {
            // First, render all sibling frames at this level passing the parent's
            // aggregated transformation matrix.
            if (frame.Sibling != null)
            {
                this.RenderFrame(frame.Sibling, parentTransformationMatrix);
            }


            Matrix tm = frame.TransformationMatrix * ((CustomFrame)frame).CustomTransform * parentTransformationMatrix;

            // Go on and render the children of this frame, passing the transformation
            // we just aggregated.
            if (frame.FirstChild != null)
            {
                this.RenderFrame(frame.FirstChild, tm);
            }


            // TODO: Adjust for the possibility of a mesh container hierarchy.

            // Perform the actual rendering for this frame.
            if (frame.MeshContainer != null)
            {
                
                world = tm;

                ExtendedMaterial[] em = frame.MeshContainer.GetMaterials();
                Texture[] t = ((CustomMeshContainer)(frame.MeshContainer)).Textures;
                for (int i = 0; i < em.Length; i++)
                {
                    this.Device.Material = em[i].MaterialD3D;
                    if (t[i] != null)
                    {
                        this.Device.SetTexture(0, t[i]);
                    }

                    frame.MeshContainer.Mesh.Mesh.DrawSubset(i);
                }
                
            }
        }
.. end it works fine too, i have little boy on screen;) but... I cant get to work my animation. I invoked ac.AdvanceTime(timeElapsed, null) (where ac is aniamation controller) before i render the object but i animation doesn't work. I get static mesh only. What i missed? Sorry for my English Thank's!

Share this post


Link to post
Share on other sites
After you advance the time on the animation controller, you need to update all of your bone matrices again. Do you do that?

Also, quite coincidentally, I just finished a SkinnedMesh sample and added it to the repository. If you get an SVN client and check out the latest version of the code, you can look at that to see what you're doing wrong.

Share this post


Link to post
Share on other sites

This topic is 3293 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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