Beispiel #1
0
        // Do not remove this, this is dynamically called from Target_Editor!
        // Changes the target transform used for this head target
        // Generates a new headtarget component, so parameters will be lost if transform is changed
        public static HipsTarget SetTarget(HumanoidControl humanoid, Transform targetTransform, bool isLeft)
        {
            HipsTarget currentHipsTarget = humanoid.hipsTarget;

            if (targetTransform == currentHipsTarget.transform)
            {
                return(currentHipsTarget);
            }

            GetDefaultBone(humanoid.targetsRig, ref targetTransform, HumanBodyBones.Hips);
            if (targetTransform == null)
            {
                return(currentHipsTarget);
            }

            HipsTarget hipsTarget = targetTransform.GetComponent <HipsTarget>();

            if (hipsTarget == null)
            {
                hipsTarget = targetTransform.gameObject.AddComponent <HipsTarget>();
            }

            hipsTarget.NewComponent(humanoid);
            hipsTarget.InitComponent();

            return(hipsTarget);
        }