In my VR game prototype, I’ve set it so held objects are at the correct angle for my Index controllers, but when I hold anything with the original Vive’s wand controllers, that same angle feels completely wrong. If I hold a pistol in front of me with my hand on the Vive controller as if I were holding a real pistol, the gun ends up pointed straight up rather than at the target, even though on Index the gun points exactly where I intended.
I wanted to fix this by adding a transform offset to the hands depending on which controller is in use, but after looking over the docs and the XR Tools demo, I haven’t come across anything that would let me actually identify the controller, aside from asking the player to set it in a menu. Is there any way to get this automatically?
This is one of the achilles heals of OpenXR. You can check the interaction profile associated with the controller by checking the profile on the related tracker.
However it is important to realise that it’s dangerous to make assumptions here.
First, different XR runtimes may have differences for the same controllers, though this has largely been smoothed over for the major platforms.
Second, an XR runtime may choose to “emulate” an interaction profile if no suitable profile is provided (especially when new hardware is involved), so it may tell you the touch profile is selected, but it’s actually a WMR controller pretending to be a touch controller.
Also the different poses are not defined well enough.
The aim pose used to be implemented by most runtimes as a straight forward pointer at the tip of the controller, however many runtimes now change this slightly do a more natural pointing direction for UI interactions (usually pointing slightly inwards) and for hand tracking, the direction even changes depending on whether you’re extending your index finger.
The grip pose is defined as a pose on the surface of your XR controller where your hand grips the controller (usually near the grip button) and while on paper it seems the best fit to use here, the poses orientation varies depending on the physical shape of the controller you hold.
Finally the palm pose is defined as a pose at the center of your palm and oriented based on your hand. This is probably the most predictable pose but it is also a pose whose support is currently optional and may not be available on all runtimes.
It is a royal PITA for which no solid solution seems to exist.
Probably your best bet is to check the interaction profile and store a transform offset for each one and atleast for devices you’ve properly tested on runtimes you’ve properly tested, it’s likely that you’ll get where you want to be.