예제 #1
0
    private void CheckForInteractionObject()
    {
        Collider[] overlappedColliders = Physics.OverlapSphere(snapColliderOrigin.position, snapColliderOrigin.lossyScale.x / 2f);

        foreach (Collider overlappedCollider in overlappedColliders)
        {
            if (overlappedCollider.CompareTag("InteractableObjects") && overlappedCollider.GetComponent <ObjectsGrab>().IsFree())
            {
                objectBeingInteractedWith = overlappedCollider.GetComponent <ObjectsGrab>();
                objectBeingInteractedWith.OnTriggerWasPressed(this);
                return;
            }
        }
    }
예제 #2
0
    void Update()
    {
        if (Controller.GetHairTriggerDown())
        {
            CheckForInteractionObject();
        }

        if (Controller.GetHairTrigger())
        {
            if (objectBeingInteractedWith)
            {
                objectBeingInteractedWith.OnTriggerIsBeingPressed(this);
            }
        }

        if (Controller.GetHairTriggerUp())
        {
            if (objectBeingInteractedWith)
            {
                objectBeingInteractedWith.OnTriggerWasReleased(this);
                objectBeingInteractedWith = null;
            }
        }
    }
예제 #3
0
 public void SwitchInteractionObjectTo(ObjectsGrab interactionObject)
 {
     objectBeingInteractedWith = interactionObject;
     objectBeingInteractedWith.OnTriggerWasPressed(this);
 }