public static void AssignHumanoidReferences(ref BipedReferences references, Animator animator, BipedReferences.AutoDetectParams autoDetectParams) { if (references == null) { references = new BipedReferences(); } if (animator == null || !animator.isHuman) { return; } references.spine = new Transform[0]; references.eyes = new Transform[0]; references.head = animator.GetBoneTransform(HumanBodyBones.Head); references.leftThigh = animator.GetBoneTransform(HumanBodyBones.LeftUpperLeg); references.leftCalf = animator.GetBoneTransform(HumanBodyBones.LeftLowerLeg); references.leftFoot = animator.GetBoneTransform(HumanBodyBones.LeftFoot); references.rightThigh = animator.GetBoneTransform(HumanBodyBones.RightUpperLeg); references.rightCalf = animator.GetBoneTransform(HumanBodyBones.RightLowerLeg); references.rightFoot = animator.GetBoneTransform(HumanBodyBones.RightFoot); references.leftUpperArm = animator.GetBoneTransform(HumanBodyBones.LeftUpperArm); references.leftForearm = animator.GetBoneTransform(HumanBodyBones.LeftLowerArm); references.leftHand = animator.GetBoneTransform(HumanBodyBones.LeftHand); references.rightUpperArm = animator.GetBoneTransform(HumanBodyBones.RightUpperArm); references.rightForearm = animator.GetBoneTransform(HumanBodyBones.RightLowerArm); references.rightHand = animator.GetBoneTransform(HumanBodyBones.RightHand); references.pelvis = animator.GetBoneTransform(HumanBodyBones.Hips); BipedReferences.AddBoneToHierarchy(ref references.spine, animator.GetBoneTransform(HumanBodyBones.Spine)); BipedReferences.AddBoneToHierarchy(ref references.spine, animator.GetBoneTransform(HumanBodyBones.Chest)); if (references.leftUpperArm != null && !BipedReferences.IsNeckBone(animator.GetBoneTransform(HumanBodyBones.Neck), references.leftUpperArm)) { BipedReferences.AddBoneToHierarchy(ref references.spine, animator.GetBoneTransform(HumanBodyBones.Neck)); } if (autoDetectParams.includeEyes) { BipedReferences.AddBoneToHierarchy(ref references.eyes, animator.GetBoneTransform(HumanBodyBones.LeftEye)); BipedReferences.AddBoneToHierarchy(ref references.eyes, animator.GetBoneTransform(HumanBodyBones.RightEye)); } }