Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
 public void Init(JointBehaviour jointBehaviour)
 {
     JointBehaviour = jointBehaviour;
     IsFree = true;
     GetComponent<Collider>().isTrigger = true;
 }