Click here to Skip to main content
13,047,131 members (60,319 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, Guys.
I have a small problem, actually 2 day evenings are spent during resolve this problem.
I have method
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);
                       TransforMeshmAngle(MeshList[i][i2], item, false, TransGroup);

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

 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);
                case RotationAxiss.ByY:
                    myAxisAngleRotation3d.Axis = new Vector3D(0, 1, 0);
                case RotationAxiss.ByZ:
                    myAxisAngleRotation3d.Axis = new Vector3D(0, 0, 1);

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

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

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?

Posted 21-May-13 22:18pm
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 22 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100