Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

i'm developping a game for solving a rubik's cube in xna framework c#

i want to know how to save bones positions after rotating them

i'm calling this method to draw bone witch construct the

protected void DrawModel()
    {
        cube.CopyAbsoluteBoneTransformsTo(modelTransforms);
        ModelMeshCollection cubes = cube.Meshes;
        List<string> yellowFace = new List<string>();

        for (int i = 0; i < cubes.Count; i++)
        {
            if (cubes.ElementAt(i).Name.ToString().Contains("F"))
            {
                yellowFace.Add(cubes.ElementAt(i).Name.ToString());
            }
        }

        for (int j = 0; j < yellowFace.Count; j++)
        {

            foreach (BasicEffect eff in cubes[yellowFace.ElementAt(j)].Effects)
            {
                eff.View = View;
                eff.Projection = Projection;
                eff.EnableDefaultLighting();
                degree = (float)degree;
                if (xtan <= degree)
                {

                    eff.World = Matrix.CreateFromAxisAngle(new Vector3(0, 0, 1), -xtan);


                }




            }


            cubes[yellowFace.ElementAt(j)].Draw();

        }

        for (int i = 0; i < cubes.Count; i++)
        {
            if (cubes.ElementAt(i).Name.ToString().Contains("F"))
            {
                continue;

            }
            else
            {
                foreach (BasicEffect eff in cubes.ElementAt(i).Effects)
                {
                    eff.View = View;


                    eff.World = Matrix.Identity;



                    eff.Projection = Projection;
                    eff.EnableDefaultLighting();
                }
                cubes.ElementAt(i).Draw();
            }

        }




    }

after i run the game the rotatin is good running but once it's done the game reload the bones as they look in the initial position

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.