GodotVR / godot_openxr_vendors

Godot 4 wrapper for OpenXR vendors loaders and extensions
MIT License
90 stars 19 forks source link

grip_touch controller signal not happening on Quest2 and Pico4 #57

Closed goatchurchprime closed 3 months ago

goatchurchprime commented 9 months ago

The XRPositionalTracker.button_pressed signal never emits a "grip_touch" touch event on the Quest2 or Pico4.

It's detecting all the other button touches in clicks in my benchmark example.

See the picture where I'm holding the trigger and grip buttons fully in (hence the input_float_changed is registering 1 on both of them).

image

My working demo is at: https://github.com/goatchurchprime/godot-demo-projects/tree/openxr_seeallfeatures/xr/OpenXRHandTrackingDemo

goatchurchprime commented 9 months ago

The same code is giving me xr_interface.xr_play_area_mode = 0 and xr_interface.get_play_area() = [ ]. I'll file this as another ticket if it helps. (I haven't checked it on the Rift yet)

BastiaanOlij commented 9 months ago

Ok, so this is not a bug, it's supposed to work this way.

Remember the default action map is just there to mimic the behaviour we have in Godot 3. It presents each input on the controller as an input for Godot, 1:1.

That means that an action will only work, if the action is mapped to an input. And action is only mapped to an input in the default map, if the input exists on the controller.

We can't magically make features of a controller appear that aren't there.

On an index we see all grip related actions mapped: image

While on the Quest no such input: image

This is the danger of mapping inputs 1:1 and really how the action map isn't supposed to be used. You should create an action map for your game with the actions your game needs, and then map the available inputs accordingly. Even then it is possible you use a controller that doesn't have the required inputs for your game of instance:

For XR Tools this for instance means that we should create our own XR Tools action map. We didn't because for a long time we wanted to keep compatibility between Godot 3 and Godot 4, and now it's a major breaking change. But officially we should have actions for each feature, and map them to the required buttons in the action map, instead of selecting the action from a dropdown on the function.

So say for our jump function, instead of having: image

We should remove the "Jump Button Action" and instead have an action called "Jump" in the action map, and have that action mapped to the best input on each controller. Right now jump is not possible on for instance a WMR controller because there is no A/X button on those devices, but when using actions properly, we could map the Jump action to one of the touchpad corners (it can function as a D-pad, though we need to implement an extension for that).

To be exact, XR Tools completely breaks right now if a user decides to make their own action map and strays away from the actions XR Tools assumes are there.

BastiaanOlij commented 9 months ago

Actually looking through all the profiles, I don't think any controllers even support touch on the grip button, only grip force which is only available on Index.

Edit, yup, grip_touch should be removed from the default action map, no controller supports it..

BastiaanOlij commented 9 months ago

Removing the dud action here: https://github.com/godotengine/godot/pull/85048

BastiaanOlij commented 3 months ago

Closing this issue as resolved through the above PR.