public void MapArmature() { toFollowAvatar = ExperimentManager.Instance.Avatar; Transform followAmature = toFollowAvatar.Armature; followTransform = followAmature; if (toFollowAvatar != null && followAmature != null) { Transform[] allChildrenTargets = followAmature.GetComponentsInChildren <Transform>(); Transform[] allChildren = thisTransform.GetComponentsInChildren <Transform>(); foreach (Transform bone in allChildren) { if (bone.GetComponent <Rigidbody>() != null) { foreach (Transform targetBone in allChildrenTargets) { if (targetBone.name == bone.name && !armatureMap.ContainsKey(targetBone)) { armatureMap.Add(bone, targetBone); break; } } } } } }
// Use this for initialization void Start() { instance = FindObjectOfType <ExperimentManager>(); if (instance == null) { instance = this; DontDestroyOnLoad(this); } recorder = FindObjectOfType <RigidbodyRecorder>(); RigidbodyAvatar[] avatars = FindObjectsOfType <RigidbodyAvatar>(); foreach (RigidbodyAvatar av in avatars) { if (av.name.Contains("GroundTruth")) { avatar = av; } } moveAlong = FindObjectOfType <RigidBodyMoveAlong>(); }