Forum Libraries, Components, and Plugins

Reading from joystick?

I have tried this 2 ways. First by calling input.SubscribeToJoystickAxisMove() during the scene creation. And by polling input.TryGetJoystickState(0, out state);

The subscribe method does not fire consistently, more like coughs up and event roughly 3-7+ seconds as I am rapidly moving the joystick levels. The JoystickAxisMoveEventArgs object that follows it provides a number value in the position, but since it really isnt changing, i can't figure it for anything.

The other way of polling input.TrGetJoyStickState returns a true result.

JoystickState state;
bool result = input.TryGetJoystickState(0, out state);
float p = state.GetAxisPosition(0);

But the value in p is always zero.

On the plus side, input.GetNumberOfJoySticks does recognized the correct count when i have my joystick plugged in and when it is not. So it sees it but I can't decipher how to read the values. Any help?

Thanks,
Matt

Answers

  • EgorBoEgorBo BYXamarin Team ✭✭✭

    @MattOsosky the Joystick api is currently buggy. I'd recommend to implement it via platform API while it's not fixed.

Sign In or Register to comment.