Drone Flight on WebGL

I was looking for a quick and easy solution to showcase Unity Samples and the WebGL route still seems to be the less painful option compared to sharing an executable, publishing on app stores or even Facebook Gameroom and go through a review process.

http://orbitalfoundry.com/WebGL/DroneFlight2/index.html

I updated the sample I wrote for the Microsoft Mixed Reality Immersive VR headset to a WebGL version and included keyboard support. It would still work with an Xbox Gamepad as a WebGL application, but I would not expect a lot of users would connect their gamepad to a PC for a web sample. The sample also loads on an iPhone and iPad – just no means of control due to lack of gamepad or keyboard. Updating the app to include keyboard support from the Xbox gamepad was relatively painless because Unity’s Input system has a direct solution, extending for touch controls is the extra effort.

The solution is done through the Project Setting/Input properties. The key step is to duplicate the Joystick (Xbox Gamepad is handled as a joystick) property definitions and include Keyboard support.

Input

In the sample image, “Axis4” (4th Joystick Axis) corresponds to an Xbox Controller – Right Thumbstick X-Axis. The entry for “Axis4” is duplicated and the “left” arrow and “right” arrow keys are defined with Key or Mouse button support. Gravity is the rate where the axis value returns to zero and Sensitivity is the rate of value increase on button press.

For questions, comments or contact – follow/message me on Twitter @rlozada