示例#1
0
 public static void AddBones(this SkeletonCache skeleton, BoneCache[] bones, bool worldPositionStays)
 {
     foreach (var bone in bones)
     {
         skeleton.AddBone(bone, worldPositionStays);
     }
 }
示例#2
0
        public static BoneCache CreateBone(this SkeletonCache skeleton, BoneCache parentBone, Vector3 position, Vector3 endPosition, bool isChained, string name)
        {
            Debug.Assert(skeleton != null);

            if (parentBone != null)
            {
                Debug.Assert(skeleton.Contains(parentBone));
            }

            var bone = skeleton.skinningCache.CreateCache <BoneCache>();

            bone.SetParent(parentBone);
            bone.name          = name;
            bone.bindPoseColor = ModuleUtility.CalculateNiceColor(skeleton.BoneCount, 6);
            bone.position      = position;
            bone.endPosition   = endPosition;

            if (isChained && parentBone != null)
            {
                parentBone.chainedChild = bone;
            }

            skeleton.AddBone(bone);


            return(bone);
        }