Ejemplo n.º 1
0
        public override void OnTriggerEnter(Collider collider)
        {
            bool otherHasKinematicPhysics = false;
            bool otherIsHumanoid          = false;

            Rigidbody otherRigidbody = collider.attachedRigidbody;

            if (otherRigidbody != null)
            {
                AdvancedHandPhysics kp = otherRigidbody.GetComponent <AdvancedHandPhysics>();
                otherHasKinematicPhysics = (kp != null);
                HumanoidControl humanoid = otherRigidbody.GetComponent <HumanoidControl>();
                otherIsHumanoid = (humanoid != null);
            }

            if (handRigidbody != null &&
                handRigidbody.isKinematic &&
                (!collider.isTrigger || otherHasKinematicPhysics) &&
                !otherIsHumanoid)
            {
                colliding   = true;
                hasCollided = true;
                if (otherRigidbody != null)
                {
                    handTarget.touchedObject = otherRigidbody.gameObject;
                    SetNonKinematic(handRigidbody, handTarget.colliders);
                }
                else
                {
                    handTarget.touchedObject = collider.gameObject;
                    SetNonKinematic(handRigidbody, handTarget.colliders);
                }

                ProcessFirstCollision(handRigidbody, collider);
            }

            if (hasCollided)
            {
                Rigidbody objRigidbody = collider.attachedRigidbody;
                if (objRigidbody != null)
                {
                    HandInteraction.GrabCheck(handTarget, objRigidbody.gameObject);
                }
                else
                {
                    HandInteraction.GrabCheck(handTarget, collider.gameObject);
                }
            }
        }
Ejemplo n.º 2
0
 public virtual void OnTriggerStay(Collider collider)
 {
     HandInteraction.GrabCheck(handTarget, handTarget.touchedObject);
 }