Example #1
0
    public void HandleOver(Collider _collider)
    {
        if (_collider.gameObject.tag == "GameController")
        {
            return;
        }

        if (!inUse)
        {
            return;
        }

        if (inStretchMode)
        {
            return;
        }

        // If we hit an interactive item
        if (_collider.gameObject.GetComponent <VRInteractiveObject> ())
        {
            DeviceVibrate();

            touchedObj            = _collider.gameObject;
            m_CurrentInteractible = touchedObj.GetComponent <VRInteractiveObject> ();
            m_CurrentInteractible.StartTouching(gameObject);
        }
    }
Example #2
0
    private void OnTriggerEnter(Collider collider)
    {
        Debug.Log("!");

        // ignore if it's another controller
        if (collider.gameObject.tag == "GameController")
        {
            return;
        }

        // ignore if already grabbing something
        if (grabSomething)
        {
            return;
        }

        // If we hit an interactive item
        if (collider.gameObject.GetComponent <VRInteractiveObject> ())
        {
            DeviceVibrate();
            //Debug.Log (gameObject.name + " touch " + collider.name);

            touchedObj            = collider.gameObject;
            m_CurrentInteractible = touchedObj.GetComponent <VRInteractiveObject> ();
            m_CurrentInteractible.StartTouching(gameObject);

            if (touchedObj.GetComponent <Rigidbody> ())
            {
                objHasRigidbody = true;

                if (touchedObj.GetComponent <Rigidbody> ().isKinematic)
                {
                    objIsKinematic = true;
                }
                else
                {
                    objIsKinematic = false;
                }
            }
            else
            {
                objHasRigidbody = false;
            }
        }
    }
Example #3
0
    public void HandleOver(Collider _collider)
    {
        if (_collider.CompareTag("GameController"))
        {
            return;
        }

        if (!inUse)
        {
            return;
        }

        // ignore if in self-stretching mode
//		if (m_inSelfScalingMode || m_inSelfScalingSupportMode)
        if (isBusySelfScaling)
        {
            return;
        }

        // ignore if already grabbing something
        if (grabSomething)
        {
            return;
        }

        if (inStretchMode)
        {
            return;
        }

        // If we hit an interactive item
        if (_collider.gameObject.GetComponent <VRInteractiveObject> ())
        {
            DeviceVibrate();

            touchedObj            = _collider.gameObject;
            m_CurrentInteractible = touchedObj.GetComponent <VRInteractiveObject> ();
            m_CurrentInteractible.StartTouching(gameObject);
        }
    }
Example #4
0
    public void HandleStay(Collider _collider)
    {
        if (_collider.gameObject.tag == "GameController")
        {
            return;
        }

        // double check if after triggerExit, but still try to grab but not being able to do triggerEnter
        if (!inUse)
        {
            return;
        }

        // ignore if in self-stretching mode
//		if (m_inSelfScalingMode || m_inSelfScalingSupportMode)
        if (isBusySelfScaling)
        {
            return;
        }

        // ignore if already grabbing something
        if (grabSomething || touchedObj)
        {
            return;
        }

        // If we hit an interactive item
        if (_collider.gameObject.GetComponent <VRInteractiveObject> ())
        {
            DeviceVibrate();

            touchedObj            = _collider.gameObject;
            m_CurrentInteractible = touchedObj.GetComponent <VRInteractiveObject> ();
            m_CurrentInteractible.StartTouching(gameObject);
        }
    }