3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OculusでBuffaloのUSBコントローラーを動かす方法

Last updated at Posted at 2014-08-27

十字キーでの移動

OVRPlayerController.csを直接書き換えます。

246行目あたり(ovr_unity_0.4.2_lib時点)に

OVRPlayerController.cs
		// WASD
		if (Input.GetKey(KeyCode.W)) moveForward = true;
		if (Input.GetKey(KeyCode.A)) moveLeft	 = true;
		if (Input.GetKey(KeyCode.S)) moveBack 	 = true; 
		if (Input.GetKey(KeyCode.D)) moveRight 	 = true; 
		// Arrow keys
		if (Input.GetKey(KeyCode.UpArrow))    moveForward = true;
		if (Input.GetKey(KeyCode.LeftArrow))  moveLeft 	  = true;
		if (Input.GetKey(KeyCode.DownArrow))  moveBack 	  = true; 
		if (Input.GetKey(KeyCode.RightArrow)) moveRight   = true; 

以下を

OVRPlayerController.cs
		// SFC Game Pad
		if (Input.GetAxis ("Horizontal") < 0) {
			moveLeft = true;
		}
		if (Input.GetAxis ("Horizontal") > 0) {
			moveRight = true;
		}
		if (Input.GetAxis ("Vertical") < 0) {
			moveBack = true;
		}
		if (Input.GetAxis ("Vertical") > 0) {
			moveForward = true;
		}

追加します。

OVRPlayControllerのプレハブをヒエラルキーにD&Dして、実行すると見た方向にBuffaloコントローラーの十字キーで動けるようになります。

IMG_1681.JPG

Bダッシュ

//run! あたり(ovr_unity_0.4.2_lib時点)を

OVRPlayerController.cs
//		if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
		if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) || Input.GetButton("Fire2"))

のように変更します。

OVRPlayControllerのプレハブを自分のヒエラルキーに実装するとBボタンでダッシュ状態になります。

IMG_0680.JPG

3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?