// Find all necessary components and initiate public void Start() { animator = GetComponent <Animator>(); allIKComponents = (IK[])GetComponentsInChildren <IK>(); disabledIKComponents = new bool[allIKComponents.Length]; fixTransforms = new bool[allIKComponents.Length]; if (ik != null) { ik.GetIKSolver().OnPostUpdate += AfterLastIK; } // Gather all the rigidbodies and their associates Rigidbody[] rigidbodies = (Rigidbody[])GetComponentsInChildren <Rigidbody>(); int firstIndex = rigidbodies[0].gameObject == gameObject? 1: 0; rigidbones = new Rigidbone[firstIndex == 0? rigidbodies.Length: rigidbodies.Length - 1]; for (int i = 0; i < rigidbones.Length; i++) { rigidbones[i] = new Rigidbone(rigidbodies[i + firstIndex]); } // Find all the child Transforms Transform[] C = (Transform[])GetComponentsInChildren <Transform>(); children = new Child[C.Length - 1]; for (int i = 0; i < children.Length; i++) { children[i] = new Child(C[i + 1]); } }
//private bool[] disabledIKComponents = new bool[0]; // Find all necessary components and initiate private void Start() { animator = GetComponent <Animator>(); // Gather all the rigidbodies and their associates Rigidbody[] rigidbodies = (Rigidbody[])GetComponentsInChildren <Rigidbody>(); int firstIndex = rigidbodies[0].gameObject == gameObject ? 1 : 0; rigidbones = new Rigidbone[firstIndex == 0 ? rigidbodies.Length : rigidbodies.Length - 1]; for (int i = 0; i < rigidbones.Length; i++) { rigidbones[i] = new Rigidbone(rigidbodies[i + firstIndex]); } // Find all the child Transforms Transform[] C = (Transform[])GetComponentsInChildren <Transform>(); children = new Child[C.Length - 1]; for (int i = 0; i < children.Length; i++) { children[i] = new Child(C[i + 1]); } }
// Find all necessary components and initiate public void Start() { animator = GetComponent<Animator>(); allIKComponents = (IK[])GetComponentsInChildren<IK>(); disabledIKComponents = new bool[allIKComponents.Length]; fixTransforms = new bool[allIKComponents.Length]; if (ik != null) ik.GetIKSolver().OnPostUpdate += AfterLastIK; // Gather all the rigidbodies and their associates Rigidbody[] rigidbodies = (Rigidbody[])GetComponentsInChildren<Rigidbody>(); int firstIndex = rigidbodies[0].gameObject == gameObject? 1: 0; rigidbones = new Rigidbone[firstIndex == 0? rigidbodies.Length: rigidbodies.Length - 1]; for (int i = 0; i < rigidbones.Length; i++) { rigidbones[i] = new Rigidbone(rigidbodies[i + firstIndex]); } // Find all the child Transforms Transform[] C = (Transform[])GetComponentsInChildren<Transform>(); children = new Child[C.Length - 1]; for (int i = 0; i < children.Length; i++) { children[i] = new Child(C[i + 1]); } }