VRTK3.3.0 圆盘的上下左右键

直接上代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using VRTK;
public class Test : MonoBehaviour {

    public VRTK_ControllerEvents vRTK_ControllerEvents;
    void Start() {
        vRTK_ControllerEvents.TouchpadPressed += new ControllerInteractionEventHandler(OnTouchPadPressed);
    }


    private void OnTouchPadPressed(object sender, ControllerInteractionEventArgs e)
    {

        if (e.touchpadAngle <= 45 || e.touchpadAngle >= 315)
        {
            print("");
        }
        else if (e.touchpadAngle > 45 && e.touchpadAngle <= 135)
        {
            print("");
        }
        else if (e.touchpadAngle > 135 && e.touchpadAngle <= 225)
        {
            print("");
        }
        else if (e.touchpadAngle > 225 && e.touchpadAngle < 315)
        {
            print("");
        }
    } }

 

转载于:https://www.cnblogs.com/myunity/p/11307563.html

你可能感兴趣的:(VRTK3.3.0 圆盘的上下左右键)