private void OnCollisionEnter(Collision other) { if (!isInit) { return; } Rigidbody myBody = GetComponent <Rigidbody>(); if (myBody != null) { myBody.constraints = RigidbodyConstraints.FreezeAll; } // TODO: Make more dynamic if (other.collider.tag != "Weapon" && other.collider.tag != "Player") { BaseAnimal animal = other.collider.transform.root.GetComponent <BaseAnimal>(); if (animal != null) { if (other.collider.name.Contains("leg")) { animal.Hit(.8f); } else { animal.Hit(3f); } transform.SetParent(other.collider.transform); transform.GetComponent <Collider>().enabled = false; } isInit = false; } }