Trying to use XR Input and working on joystick-based locomotion but trying to access the joystick always comes up 0. I’m using Oculus Rift Touch controllers (Not Rift S or Quest) and the devices and features needed are present.
Here’s my code for reference:
private List leftHands = new List();
private InputDevice rightHand;
private void Update()
{
// We get our hand(s) first before attempting to locomote
GetHands();
Locomotion();
}
private void GetHands()
{
InputDevices.GetDevicesAtXRNode(XRNode.LeftHand, leftHands);
}
private void Locomotion()
{
if (leftHands.Count == 0)
return;
if (!leftHands[0].isValid)
return;
Vector2 movementVector;
if (leftHands[0].TryGetFeatureValue(CommonUsages.primary2DAxis, out movementVector))
{
// Shows that value is always zero
print($"Left Joystick Values: {movementVector}");
if (Mathf.Abs(movementVector.x) >= 0.2f || Mathf.Abs(movementVector.y) >= 0.2f)
{
Move(movementVector);
}
}
}