Ejemplo n.º 1
0
        // Tries to guess the limb bones based on naming
        private static void DetectLimb(BipedNaming.BoneType boneType, BipedNaming.BoneSide boneSide, ref Transform firstBone, ref Transform secondBone, ref Transform lastBone, Transform[] transforms)
        {
            Transform[] limb = BipedNaming.GetBonesOfTypeAndSide(boneType, boneSide, transforms);

            if (limb.Length < 3)
            {
                //Warning.Log("Unable to detect biped bones by bone names. Please manually assign bone references.", firstBone, true);
                return;
            }

            // Standard biped characters
            if (limb.Length == 3)
            {
                firstBone  = limb[0];
                secondBone = limb[1];
                lastBone   = limb[2];
            }

            // For Bootcamp soldier type of characters with more than 3 limb bones
            if (limb.Length > 3)
            {
                firstBone  = limb[0];
                secondBone = limb[2];
                lastBone   = limb[limb.Length - 1];
            }
        }
Ejemplo n.º 2
0
 public static Transform GetFirstBoneOfTypeAndSide(BipedNaming.BoneType boneType, BipedNaming.BoneSide boneSide, Transform[] bones)
 {
     Transform[] bonesOfTypeAndSide = BipedNaming.GetBonesOfTypeAndSide(boneType, boneSide, bones);
     if (bonesOfTypeAndSide.Length == 0)
     {
         return(null);
     }
     return(bonesOfTypeAndSide[0]);
 }
Ejemplo n.º 3
0
 private static void DetectLimb(BipedNaming.BoneType boneType, BipedNaming.BoneSide boneSide, ref Transform firstBone, ref Transform secondBone, ref Transform lastBone, Transform[] transforms)
 {
     Transform[] bonesOfTypeAndSide = BipedNaming.GetBonesOfTypeAndSide(boneType, boneSide, transforms);
     if (bonesOfTypeAndSide.Length < 3)
     {
         return;
     }
     if (bonesOfTypeAndSide.Length == 3)
     {
         firstBone  = bonesOfTypeAndSide[0];
         secondBone = bonesOfTypeAndSide[1];
         lastBone   = bonesOfTypeAndSide[2];
     }
     if (bonesOfTypeAndSide.Length > 3)
     {
         firstBone  = bonesOfTypeAndSide[0];
         secondBone = bonesOfTypeAndSide[2];
         lastBone   = bonesOfTypeAndSide[bonesOfTypeAndSide.Length - 1];
     }
 }
Ejemplo n.º 4
0
 public static Transform GetBone(Transform[] transforms, BipedNaming.BoneType boneType, BipedNaming.BoneSide boneSide = BipedNaming.BoneSide.Center, params string[][] namings)
 {
     return(BipedNaming.GetNamingMatch(BipedNaming.GetBonesOfTypeAndSide(boneType, boneSide, transforms), namings));
 }