示例#1
0
    private void TriggerStay(Collider other, VRSensor sensor)
    {
        ControllerInformation     controller  = controllerManager.GetControllerInfo(sensor.GetComponent <SteamVR_TrackedObject>());
        ButtonInteractInformation grabObjInfo = (ButtonInteractInformation)controller.GetFunctionalityInfoByType(typeof(ButtonInteractInformation));

        if (grabObjInfo.buttonInRange == null)
        {
            VRButton button = other.GetComponent <VRButton>();
            if (button != null)
            {
                grabObjInfo.buttonInRange = button;
                button.OnControllerEnter();
            }
        }
    }
示例#2
0
    private void TriggerEnter(Collider other, VRSensor sensor)
    {
        ControllerInformation     controller  = controllerManager.GetControllerInfo(sensor.GetComponent <SteamVR_TrackedObject>());
        ButtonInteractInformation grabObjInfo = (ButtonInteractInformation)controller.GetFunctionalityInfoByType(typeof(ButtonInteractInformation));

        VRButton button = other.GetComponent <VRButton>();

        //we check if it is a button and we are not already interacting with one
        if (button != null && grabObjInfo.buttonInRange == null)
        {
            grabObjInfo.buttonInRange = button;
            //And then we apply color to the button..
            button.OnControllerEnter();
        }
    }