VRTK 圆盘的上下左右键

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("左");
        }
    } }

你可能感兴趣的:(Unity,VR)