Click here to Skip to main content
15,907,000 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, Guys.
I have a small problem, actually 2 day evenings are spent during resolve this problem.
So.
I have method
C#
private void InitializeAnimations()
    {
      for (int i = 0; i < MeshList.Count; i++)
        {
          TransGroupList = new List<Transform3DGroup>();
          Console.WriteLine("Rotate item: {0}",i);

           foreach (RotationAxiss item in  Enum.GetValues(typeof(RotationAxiss)))
             {
                var TransGroup = new Transform3DGroup();
                Console.WriteLine("Rotate By: {0}   axe", item.ToString());

                    for (int i2 = 0; i2 < MeshList[i].Count; i2++)
                    {
                       if (MeshList[i].Count - 1 == i2)
                       TransforMeshmAngle(MeshList[i][i2], item, true, TransGroup);

                       else
                       TransforMeshmAngle(MeshList[i][i2], item, false, TransGroup);
                     }
                     TransGroupList.Add(TransGroup);                     
              }
               ListTransGroupList.Add(TransGroupList);
           }
     }


MeshList is a like List<list><geometrymodel3d>>
Foreach GeometryModel3D I am creating animation.
By using this method:

C#
private void TransforMeshmAngle(GeometryModel3D input, RotationAxiss rotAxisEnum, bool isLastItem, Transform3DGroup group)
       {
           // Create and apply a transformation that rotates the object.
           RotateTransform3D myRotateTransform3D = new RotateTransform3D();

           AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D();
           myRotateTransform3D.Rotation = myAxisAngleRotation3d;
           input.Transform = myRotateTransform3D;

           switch (rotAxisEnum)
           {
               case RotationAxiss.ByX:
                   myAxisAngleRotation3d.Axis = new Vector3D(1, 0, 0);
                   break;
               case RotationAxiss.ByY:
                   myAxisAngleRotation3d.Axis = new Vector3D(0, 1, 0);
                   break;
               case RotationAxiss.ByZ:
                   myAxisAngleRotation3d.Axis = new Vector3D(0, 0, 1);
                   break;
               default:
                   break;
           }
           group.Children.Add(myRotateTransform3D);
       }


All items are added to list like is should.
Everything seems very good :)
But....

When I try to run animation. Only Last item in " TransGroupList " can be animated.

C#
foreach (RotateTransform3D item in ListTransGroupList[index][index2].Children)
       {
         item.Rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, InitDoubleAnim(), HandoffBehavior.Compose);
        }


Also i tried to change sequence of enum RotationAxiss.
And same. only Last item is animated.

I can run different animations, with rule that it is last item in TransGroupList.

So, Can someone tell me where is mistake?

Thanks.
Posted
Comments
valza 22-May-13 4:27am    
MeshList is List<.List<.GeometryModel3D.>.>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900