Open goatchurchprime opened 2 years ago
Sorry for the late response on this, I'm not entirely sure if you've set this up correctly. The problem is that hand tracking is currently completely independent of controller tracking.
So ARVRController 1+2 are always controllers with the button mapping of controllers. ARVRController 3+4 represent the hand inputs and should have this pinch mapping on button 7. This is ONLY available on Quest and ONLY when you are not holding a controller.
Okay, I'm beginning to see what's going on. (Lucky the godot IDE is so good I can trace through this stuff in the debugger!)
This is in Godot Open XR demo.
I've found that func Function_pointer._on_button_pressed(p_button)
is called with 15 when you click the controller trigger, and it's called with 4 and then 7 in hand tracking mode index pinch.
The RightHandController/Function_pointer
node has active_button
set to 15, so will only respond to the controller button.
In my code I set and reset this active_button
value between 15 and 4 so that it responds to the hand tracking index pinch in hand tracking mode. It seemed the only way I could do it, short of hacking the Function_pointer
code to accept two values.
However, you've included a second sneaky instance in RightHandAim/Function_pointer
where the active_button
is 7, and this one responds to the hand tracking pinch.
I think I went wrong when the Function_pointer under the RightHandController still partly works in in hand-tracking mode, so not knowing any better I forced it to do the work.
Would it be more correct if you could totally disable all the functions under RightHandController when in hand-tracking mode? Would it also be preferable if RightHand could go under RightHandAim, or is it necessary to be at the top level?
When I use the Function pointer feature in xr-tools with hand tracking turned on, the Index-Thumb pinch gesture registers as a button press VR_BUTTON_4. https://github.com/GodotVR/godot-xr-tools/issues/180
I think I've found the place in the code that does the mapping on this line: https://github.com/GodotVR/godot_openxr/blob/master/src/openxr/extensions/xr_ext_hand_tracking_extension_wrapper.cpp#L332
and it says Index pinch should be mapped to the A/X button (code 7), so it's not doing what it says in the source.
Furthermore, I don't think this mapping is standard. In the Oculus home screen the index pinch definitely works the same as the front trigger, because you can put down the controller and do everything you did with the index pinch (not the ring finger pinch as it says on line 342). Additionally, it would be useful if the middle finger pinch mapped to the grip button as it does in the OpenVR library.