Beispiel #1
0
        /// <summary>
        /// Clones this skeleton.
        /// </summary>
        /// <returns>A Skeleton instance with the same data as this one.</returns>
        public Skeleton Clone()
        {
            var result = new Skeleton();
            result.Name = this.Name;
            result.Bones = new Bone[Bones.Length];

            for (int i = 0; i < Bones.Length; i++){
                result.Bones[i] = Bones[i].Clone();
            }

            /** Construct tree **/
            foreach (var bone in result.Bones)
            {
                bone.Children = result.Bones.Where(x => x.ParentName == bone.Name).ToArray();
            }
            result.RootBone = result.Bones.FirstOrDefault(x => x.ParentName == "NULL");
            result.ComputeBonePositions(result.RootBone, Matrix.Identity);
            return result;
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new Avatar instance.
 /// </summary>
 /// <param name="skel">A Skeleton instance.</param>
 public Avatar(Skeleton skel)
 {
     this.Skeleton = skel.Clone();
     this.BaseSkeleton = skel.Clone(); //keep a copy we can revert back to
 }
Beispiel #3
0
 /// <summary>
 /// Creates a new instance of SimAvatar.
 /// </summary>
 /// <param name="skel">A Skeleton instance.</param>
 public SimAvatar(Skeleton skel)
     : base(skel)
 {
 }