- Home /
Unity XR get controller thumb stick axis
I'm trying to setup VR movement with Rift S touch controllers, I have controller positional tracking in but i cannot get any value from the stick movement on the controller. Also cant find much help about the XR input system. I currently have:
void Update()
{
SetControllerPositions(_leftDevice, LeftHandController);
SetControllerPositions(_rightDevice, RightHandController);
updateMovement();
}
private void SetControllerPositions(InputDevice device, GameObject controller)
{
if (device.TryGetFeatureValue(CommonUsages.devicePosition, out var position))
{
controller.transform.position = position;
}
if (device.TryGetFeatureValue(CommonUsages.deviceRotation, out var rotation))
{
controller.transform.rotation = rotation;
}
}
private void updateMovement()
{
if (_leftDevice.TryGetFeatureValue(CommonUsages.primary2DAxis, out var vector))
{
Debug.Log(vector);
gameObject.GetComponent<Rigidbody>().AddRelativeForce(vector * 1, ForceMode.Acceleration);
}
}
How do i get the thumb axis?
Comment
Your answer
Follow this Question
Related Questions
Vive controller interaction with gameobject (C#) 0 Answers
Google VR app - Huge drift on Samsung Galaxy S6/S7 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers