Animated MD2-Model does not animate!?

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
jettitore
Posts: 11
Joined: Sat Jun 24, 2006 11:27 pm

Animated MD2-Model does not animate!?

Post by jettitore »

Hi,

I have a strange problem with an animated MD2-Model. If I use this samplecode it works:

Code: Select all

IAnimatedMesh pacmesh = smgr.GetMesh(@".\Models\pac.md2");
IAnimatedMeshSceneNode pac = smgr.AddAnimatedMeshSceneNode(pacmesh, null, 0);

pac.Position = new Vector3D(4 * rows, 0, 4 * i - 4);
pac.SetMaterialTexture(0, vdrv.GetTexture(@".\Models\pac.jpg"));
pac.SetMaterialFlag(MaterialFlag.LIGHTING, false);

ICameraSceneNode cam = smgr.AddCameraSceneNodeFPS();
But if I use this code in another project the animation does not play. What could be the reason for this? I hope somebody can help me to solve this problem.

jettitore
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

well if it works in the example and not in your code, then I guess there's a problem with your code. Please post the relevant part of your code that doesn't work.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
jettitore
Posts: 11
Joined: Sat Jun 24, 2006 11:27 pm

Post by jettitore »

Okay, I've found the bug in my code/in the irrlicht code.

Code: Select all

   
//Update is called each frame
        public virtual void Update(RenderDelegate renderDelegate)
        {
            if (device.Run()) //If not called each frame, animations will not be played
            {

                // Update the screen
                vdrv.BeginScene(true, true, new Color(255, 0, 0, 0));

                // Handle all the rendering
                if (renderDelegate != null)
                    renderDelegate(); //Only in Debug-Mode
                else
                    Render(); //Runs allways in Release-Mode

                if (isLevelLoaded)
                {
                    smgr.DrawAll();
                }


                vdrv.EndScene();

                base.Update(); //base-methos is empty!
            }
        } // Update(renderDelegate)

jettitore
Locked