I am unable to get a Press Point to work with gripforce on the knuckles. I can manually read the value through code, but the input system press point is not working. Resorting to doing this manually would cause a lot of hoops to jump through.
Has anyone been able to use a press point with gripforce on OpenXR?
So, I resolved this but thought I would share how I handled it. Not sure it is the best way. Bottom line, I needed to base the SELECT input action on INDEX controllers using grip force while also allowing regular grip for other XR controllers. Whenever I added that under the select action along with other generic XR controller bindings it did not work correctly. Basically, the grip pressure and grip were reported as one value and it was always 0 or 1.
To solve this, I created a new control scheme just for Index controllers. The problem is it won’t just automatically use that control scheme, so whenever controller devices are added I check if it is an index controller and if so I setup a mask on the inputactionsasset to only use the Index control scheme.
Turns out, one and a half year later this problem still persists. I also need a special “hard squeeze” function on Index, so it will work alongside normal grabbing of objects, but is not triggered accidentally all the time. So I added GripForce actions in the GameInputActions, but the returned value was always 1. Thanks to the advice from user yarsrevenge, I figured out that I “only” need to disable my “special grip actions” for the leftHand and rightHand XRcontrollers, in case it’s detected that the player is using Knuckles controllers. The special actions for the Knuckles GripForce can always stay on, so it’s not as much switching around as I initally thought.
You can disable individual GameInputAction by using
_gameInputActions = new GameInputActions();
_gameInputActions.LeftHand.YourGameInputActionsName.Disable();
as an example. I hope this helps, took me ages to finally figure it out
Ok, I recently ran into this same issue. The grip pressed action was firing every time I touched the controller. Now I just check the “grip force” which is specific to the index, and on all other platforms I just read “grip pressed”. It’s frustrating that we need a separate code path for the Valve Index. I’ve attached an image with my input settings.
gripForce vanished from the path browser for us when we updated to the latest 2021.3 release. It still works but you have to enter the path manually by clicking the little ‘T’ button next to the binding path dropdown. Then you need <ValveIndexController>{LeftHand}/gripForce replacing Left/Right as appropriate for how you want to bind it.
The same update (which also took the Input System from 1.3 to 1.7) also broke what we had been doing, which was binding the gripForce axis to a Button type action. I had to make a new custom IInputInteraction to get it to work like a button the same way we use gripPressed from all the other XR controllers.
The key part of that custom IInputInteraction being
public void Process(ref InputInteractionContext context)
{
float actuation = context.ComputeMagnitude();
if (_isPressed)
{
if (actuation <= ReleasePointOrDefault)
{
_isPressed = false;
context.Canceled();
}
}
else if (actuation >= PressPointOrDefault)
{
_isPressed = true;
// Stay performed until release.
context.PerformedAndStayPerformed();
}
}
Where the Release and Press point definitions were copied from the built-in PressInteraction.