Home » #gamedev » Configuring Unity for use with a Bluetooth Controller in VR (abridged).

Configuring Unity for use with a Bluetooth Controller in VR (abridged).

Recently a student asked me how to configure a Bluetooth Controller for use in VR. The short answer is that configuration is a simple affair of attaching an FPS Controller script to whatever has the VR prefab attached to it. The Edit>Project Settings>Input settings are all pre-configured for use with a mouse and keyboard and joystick controller – simultaneously. If you have a single analog controller, an issue will arise; the joysticks x axis (left and right motions) will cause you to strafe. The desired operation is to rotate.

We can work towards solving the strafing issue by asking the following question; under other circumstances, how would you rotate the character? Using a keyboard and mouse, A and D keys strafe while a mouse is used to both look around and guide the player’s body in different directions. Why not adapt the mouse inputs for use with a single analog joystick?

  • In Edit>Project Settings>Input settings, select the Mouse X input and duplicate it.
  • Change its Type to Joystick Axis.
  • Then disable the second Horizontal element by changing its Type to Key or Mouse Button.

If you have a dual-analog controller you should be able to adapt the inputs in a likewise manner.

  • In Edit>Project Settings>Input settings, select the second Horizontal and Vertical elements and duplicate them.
  • Change their Axis parameters to reflect those of your second analog joystick (consult the controller’s documentation or experiment).
  • In this example there’s no need to disable the second Horizontal element

 

I hope you found this content useful. If so, please like and subscribe and consider contributing to
my brand new Patreon
so that I can continue to produce great #gamedev and #game art content while battling cancer!

brand new live streaming!
featuring #gameplay, #gamedev, and soon, live #gamedev lessons!

Watch live video from nickelcitypixels on www.twitch.tv

Be sure to subscribe to the
nickelcitypixels youtube channel
so that you don’t miss out! I hope to get to 500 subscribers by Oct. 5th, 2018 (exactly 1 year after my diagnosis)!

Ditto the blog newsletter!

I'm active on twitter, username
@NickelCityPixel.

And finally, I've recently launched
openforcommissions.com.
It is a central site for game developers to commission artists, and for artists to get paid. Currently it is invite only, but you can increase your chances to participate by linking your portfolio in the blog post comments!

Thanks as always for your support!

One thought on “Configuring Unity for use with a Bluetooth Controller in VR (abridged).

  1. Spot i’ll carry on with this write-up, I seriously feel this fabulous website wants far more consideration. I’ll apt to be again to study much more, appreciate your that info.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*