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
