I’ve been trying to figure how to access thumb-stick input from the controller in MRTK
.
I’m new to coding and the documentation was just a bit too confusing for me to figure out.
I figured out a pointer click through the onPointerClick
methods however I just can’t figure the other inputs.
I’m sure it’s simple, I just need to see an example. Any help is appreciated.
Thanks!
You can try a script like this:
public class ThumbstickMover : InputSystemGlobalListener, IMixedRealityInputHandler<Vector2>
{
public MixedRealityInputAction moveAction;
public float speed = 1.0f;
public void OnInputChanged(InputEventData<Vector2> eventData)
{
if (eventData.MixedRealityInputAction == moveAction)
{
Vector3 localDelta = speed * (Vector3)eventData.InputData;
transform.position = transform.position + transform.rotation * localDelta;
}
}
}
For that to work you'll need to set as moveAction
an input action that is mapped to one of the thumbsticks. Let me know if you have trouble with that.