private void OnCollide(Collider other) { Collider[] selfColliders = GetComponentsInChildren <Collider>(); foreach (Collider selfCollider in selfColliders) { if (other == selfCollider) { return; } } Rigidbody otherBody = other.attachedRigidbody; if (otherBody) { JointBehaviour joint = GetComponent <JointBehaviour>(); if (joint != null && joint.IsNearJointPointHighlighted) { return; } if (otherBody.isKinematic) { Block(); } } else if (!other.isTrigger) { Block(); } }
public void Init(JointBehaviour jointBehaviour) { JointBehaviour = jointBehaviour; IsFree = true; GetComponent<Collider>().isTrigger = true; }