0 votes
by (160 points)
recategorized by

我现在使用的VRTK插件
///


/// 定义手柄事件
///

public VRTK_ControllerEvents VRTKHand;

VRTKHand.TriggerPressed += VRTKHandTriggerPressed;
private void VRTKHand
TriggerPressed(object sender, ControllerInteractionEventArgs e)
{
//扳机键按下事件 现在只能检测到右手柄扳机键按下 怎么检测左手柄扳机键按下
}

1 Answer

+1 vote
by (7.7k points)
selected by
 
Best answer

你只写了一个,再写一个绑定不同的手柄就行:

        public VRTK_ControllerEvents LeftHand;
        public VRTK_ControllerEvents RightHand;
        // Start is called before the first frame update
        void Start()
        {
            LeftHand.TriggerPressed += DoTriggerPressed;
            RightHand.TriggerPressed += DoTriggerPressed;
        }
        private void DoTriggerPressed(object obj, ControllerInteractionEventArgs e)
        {
            Debug.Log("Trigger Pressed");   
        }
by (160 points)

原来这样就可以了,竟然没反应过来。我试了下好了,非常感谢!

...