LoginSignup
0
1

More than 5 years have passed since last update.

windowsMRのモーションコントローラーのボタンの取得ではまったのでメモ

Posted at

値の取得方法

UnityでwindowsMRのモーションコントローラーのボタンのイベント取得ができなかったので調べていたんですが、僕のわかるレベルでの簡単な資料がなかったのでメモしておきます。

以下のコードで取得できます。

//Gripのボタンの取得
Input.GetKey("joystick button 5")

使い方は、

void Update(){
 //押し続けてる間イベントを取得
 if(Input.GetKey("joystick button 5")){
  Debug.Log("GripKey");
 }
 //押したイベントを取得
 if(Input.GetKeyDown("joystick button 5")){
  Debug.Log("GripKey");
 }
 //離したイベントを取得
 if(Input.GetKeyUp("joystick button 5")){
  Debug.Log("GripKey");
 }
}

モーションコントローラーのボタンの対応表はこちら。
https://developer.microsoft.com/en-us/windows/mixed-reality/gestures_and_motion_controllers_in_unity

なんか無茶苦茶にはまったので。。。これだから僕のような初心者は…

0
1
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
0
1