Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable UI interactions using an Xbox controller #4398

Conversation

luis-valverde-ms
Copy link
Contributor

Overview

Changes in this PR:

  • Gave the Xbox controller a pose in the form of a new spatial pointer interaction mapping
  • Modified Unity Joystick Manager to create pointers for controllers if they have any assigned in the pointer profile.
  • Added an entry in the default pointer profile to create GGV pointers for Xbox controllers.

Changes

@julenka
Copy link
Contributor

julenka commented May 17, 2019

Cool! Clicking worked well, bounding box felt okay. Movement felt pretty off to me.

  • When I move my joystick left/right, the object moved forward/back
  • I couldn't figure out how to get the object to move left / right instead of forward back.
  • Suggest implementing the object movement in camera space, as follows:
    • Joystick moves the object up/down/left/right
    • Bumpers move the object forward/back
    • Object can be rotated using secondary bumpers

To see the expected behavior, I recommend bringing up windows mixed reality home and moving objects around using the gamepad there.

@julenka
Copy link
Contributor

julenka commented May 17, 2019

I also noticed that when controller is in resting position the object moves around a bit, most noticeable with bounding box. I think you need a bit of a deadzone for the joystick.

@luis-valverde-ms
Copy link
Contributor Author

luis-valverde-ms commented May 17, 2019

Movement felt pretty off to me

Was the controller also moving the camera when you tried it? If you disable the input simulation service, objects with a ManipulationHandler should move fine left to right and in a wonky way up and down. That is down to the handler script itself, the controller is moving in a plane perpendicular to the camera.

Bumpers move the object forward/back

Can we leave that for another PR? I'm not planing on spending more time on this.

when controller is in resting position the object moves around a bit

That should be fixed by #4367

@julenka
Copy link
Contributor

julenka commented May 18, 2019

Can we leave that for another PR? I'm not planing on spending more time on this.

Sure, though we should file an issue so we don't forget. Created #4469

@julenka
Copy link
Contributor

julenka commented May 18, 2019

Was the controller also moving the camera when you tried it? If you disable the input simulation service, objects with a ManipulationHandler should move fine left to right and in a wonky way up and down. That is down to the handler script itself, the controller is moving in a plane perpendicular to the camera.

No, I don't think it was. I was using a VR headset, and did not notice any strange camera movement. Perhaps the missing piece is that I was using VR headset + gamepad, and you are just using editor simulation + gamepad?

@@ -48,12 +48,42 @@ public XboxController(TrackingState trackingState, Handedness controllerHandedne
new MixedRealityInteractionMapping(13, "B", AxisType.Digital, DeviceInputType.ButtonPress,KeyCode.JoystickButton1),
new MixedRealityInteractionMapping(14, "X", AxisType.Digital, DeviceInputType.ButtonPress,KeyCode.JoystickButton2),
new MixedRealityInteractionMapping(15, "Y", AxisType.Digital, DeviceInputType.ButtonPress,KeyCode.JoystickButton3),
new MixedRealityInteractionMapping(16, "Spatial Pointer", AxisType.SixDof, DeviceInputType.SpatialPointer, MixedRealityInputAction.None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would an xbox controller ever have a spatial pointer?

Shouldn't the pointer just default to the user's gaze, and current selections be wired up properly via UI navigation events?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was that by making the gamepad emulate a six DOF controller we would get interaction with our UI components for free, as they already consume the pointer position and rotation. The alternative is to add logic where required to explicitly handle actions like rotate, scale or move based on deltas. That being said, the more I look at it the more I like the second option.

The PR doesn't seem ready for check in and I can't spend more time on it so I'll close it. Anyone is welcome to take over either resurrecting this or starting anew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants