// Initialization of class object public AvatarContainer(GameObject avatarContainer, bool mirror = false) { this.avatarContainer = avatarContainer; // Find child object avatars in scene and save references in fields GameObject cubeC = avatarContainer.transform.Find("CubeContainer").gameObject; GameObject stickC = avatarContainer.transform.Find("StickContainer").gameObject; GameObject robotC = avatarContainer.transform.Find("RobotContainer").gameObject; GameObject smplC = avatarContainer.transform.Find("SMPLContainer").gameObject; cubeContainer = new CubeContainer(cubeC); stickContainer = new StickContainer(stickC); robotContainer = new RobotContainer(robotC, stickContainer); smplContainer = new SmplContainer(smplC, stickContainer); containers = new Dictionary <AvatarType, IAvatarSubContainer>(); containers.Add(AvatarType.CUBE, cubeContainer); containers.Add(AvatarType.STICK, stickContainer); containers.Add(AvatarType.ROBOT, robotContainer); containers.Add(AvatarType.SMPL, smplContainer); // Deactivate all other avatars except stickContainer // Note: it is necessary to do this after getting references, otherwise objects can't be found in scene stickContainer.SetActive(true); cubeContainer.SetActive(false); robotContainer.SetActive(false); smplContainer.SetActive(false); Mirror(mirror); }
public SmplContainer(GameObject container, StickContainer stickSkeleton) { SubContainerObject = container; stickContainer = stickSkeleton; GameObject smpl_male = SubContainerObject.transform.Find("SMPL_m_unityDoubleBlends_lbs_10_scale5_207_v1.0.0").gameObject; animator = smpl_male.GetComponent <Animator>(); CharacterRootTransform = smpl_male.transform.Find("m_avg_root"); absoluteOffsetMap = RiggingUtils.CreateOffsetMap(animator, CharacterRootTransform); }
public RobotContainer(GameObject container, StickContainer stickSkeleton) { SubContainerObject = container; stickContainer = stickSkeleton; GameObject robotKyle = SubContainerObject.transform.Find("Robot Kyle").gameObject; CharacterRootTransform = robotKyle.transform; animator = robotKyle.GetComponent <Animator>(); absoluteOffsetMap = RiggingUtils.CreateOffsetMap(animator, CharacterRootTransform); }