Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF C#4.0 3D
Hi, Guys.
I have a small problem, actually 2 day evenings are spent during resolve this problem.
So.
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);
 
                       else
                       TransforMeshmAngle(MeshList[i][i2], item, false, TransGroup);
                     }
                     TransGroupList.Add(TransGroup);                     
              }
               ListTransGroupList.Add(TransGroupList);
           }
     }
 
MeshList is a like List>
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);
                    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 Smile | :)
But....
 
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?
 
Thanks.
Posted 21-May-13 23:18pm
valza1.3K
Comments
valza at 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
0 OriginalGriff 315
1 Jochen Arndt 190
2 DamithSL 125
3 PIEBALDconsult 110
4 Garth J Lancaster 90
0 OriginalGriff 5,790
1 DamithSL 4,601
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,195


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 22 May 2013
Copyright © CodeProject, 1999-2014
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