using UnityEngine; namespace Passer.CreatureControl { public class Creature : MonoBehaviour { /// The target bones rig /// The target bones rig contain the target pose of the creature /// The creature movements will try to move the creature such that the target pose is reached /// as closely as possible public TargetRig targetRig; /// Match the target rig transform to the humanoid transform public static void CheckTargetRig(Creature creature, string targetRigResourceName) { if (creature.targetRig == null) { GameObject targetsRigPrefab = Resources.Load(targetRigResourceName); GameObject targetRig = Instantiate(targetsRigPrefab); targetRig.name = "Target Rig"; targetRig.transform.SetPositionAndRotation(creature.transform.position, creature.transform.rotation); targetRig.transform.SetParent(creature.transform); creature.targetRig = targetRig.GetComponent(); } } } }