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

By | March 7, 2016

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

 


A Note from Admin:


I hope you found this content useful. If so, please like and subscribe and consider contributing to

so that I can continue to produce great #gamedev and #game art content while battling cancer!

Subscribe and get ahead with the latest tech recommendations, tricks, and tutorials!

Or subscribe to:
NCP on Twitch
NCP on YouTube
NCP on Twitter (warning: politics!)

WIP Sites:
learnindiedev.com Unlike Udemy, this site will feature live lessons and game jam learn-a-thons (exactly what it sounds like)! Featuring No-Code Video Game Development, the only video course to become a published text book!

openforcommissions.com Why be hard to find? Upload your portfolio, change your open/close status with a single tweet, get paid!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.