Ejemplo n.º 1
0
    void GrabSeal(object sender, ControllerInteractionEventArgs e)
    {
        sealGrabbed = false;

        if (controllerEvents.GetGripAxis() >= 0.5f - focusRange &&
            (magicScript.FocusActive || controllerEvents.GetGripAxis() <= 0.5f + focusRange))
        {
            sealGrabbed = true;
        }
    }
Ejemplo n.º 2
0
    void OnPointerValid(object sender, DestinationMarkerEventArgs e)
    {
        if (controllerEvents == null ||
            controllerEvents.GetGripAxis() < 0.6f)
        {
            return;
        }

        VRTK_InteractableObject obj = e.raycastHit.collider.gameObject.GetComponent <VRTK_InteractableObject>();

        if (obj != null && obj.isGrabbable && !obj.IsGrabbed())
        {
        }
    }
Ejemplo n.º 3
0
    ControllerPose GetControllerPose(VRTK_ControllerEvents controller)
    {
        ovrAvatarButton buttons = 0;

        //if (OVRInput.Get(OVRInput.Button.One, controller)) buttons |= ovrAvatarButton.One;
        //if (OVRInput.Get(OVRInput.Button.Two, controller)) buttons |= ovrAvatarButton.Two;
        if (controller.startMenuPressed)
        {
            buttons |= ovrAvatarButton.Three;
        }
        if (controller.touchpadPressed)
        {
            buttons |= ovrAvatarButton.Joystick;
        }

        ovrAvatarTouch touches = 0;

        //if (OVRInput.Get(OVRInput.Touch.One, controller)) touches |= ovrAvatarTouch.One;
        //if (OVRInput.Get(OVRInput.Touch.Two, controller)) touches |= ovrAvatarTouch.Two;
        //if (controller.touchpadPressed) touches |= ovrAvatarTouch.Joystick;
        //if (OVRInput.Get(OVRInput.Touch.PrimaryThumbRest, controller)) touches |= ovrAvatarTouch.ThumbRest;
        if (controller.triggerPressed)
        {
            touches |= ovrAvatarTouch.Index;
        }
        if (controller.gripPressed)
        {
            touches |= ovrAvatarTouch.Joystick;
        }
        if (controller.touchpadPressed)
        {
            touches |= ovrAvatarTouch.Pointing;
        }
        if (controller.triggerPressed && controller.gripPressed)
        {
            touches = ovrAvatarTouch.ThumbUp;
        }
        //if (!OVRInput.Get(OVRInput.NearTouch.PrimaryThumbButtons, controller)) touches |= ovrAvatarTouch.ThumbUp;

        return(new ControllerPose
        {
            buttons = buttons,
            touches = touches,
            joystickPosition = controller.GetTouchpadAxis(),
            indexTrigger = controller.GetGripAxis(),
            handTrigger = controller.GetTriggerAxis(),
            isActive = true
        });
    }