LoginSignup
2
3

More than 5 years have passed since last update.

【VRTK】コントローラーのイベントに処理を追加する

Last updated at Posted at 2018-01-18

方法1

VRTK_ControllerEventsのアクションメソッドに、イベントハンドラーを追加する。

GetComponent<VRTK_ControllerEvents>().TriggerPressed += new ControllerInteractionEventHandler(DoTriggerPressed);

private void DoTriggerPressed(object sender, ControllerInteractionEventArgs e) {
    // 処理
}

方法2

VRTK_Controller_Eventsコンポーネントがアタッチされているオブジェクトに、VRTK_Controller_Events_Unity_Eventsコンポーネントを追加。インスペクタ上からメソッドを登録していく。

参考
[Basics] Controller Events
[VRTK解説] 「VRTK_ControllerEvents」の概要(VR空間でコントローラーを扱う) [Unity][VRTK3.0][Vive]

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3