-
Notifications
You must be signed in to change notification settings - Fork 1
Gamepad
Josh Stovall edited this page Dec 3, 2020
·
1 revision
Interact with the user controllers. This is a way to interact with the Gamepad API.
Right now, it works with the Oculus controllers. Evenutally would like to add support for non-VR controllers as well.
create controller
var controller = new XR.Gamepad();
get the right or left controller
var leftController = controller.left;
var rightController = controller.right;
get joystick
// left joystick
var joystick = controller.left.joystick;
get the buttons
var aButton = controller.button.a;
var bButton = controller.button.b;
var xButton = controller.button.x;
var yButton = controller.button.y;
get the trigger or grips
// get the left grip
var grip = controller.left.grip;
var trig = controller.left.trigger;