Bad values for joystick input in unity 5
Hi,
I have a "noname" USB joystick and I try to use it in a Unity project. The buttons are working fine, but I have troubles with axis values.
According to Unity5 documention, for each axis, I should get values :
-1.0 when the axis is pushed to the "minimum" (left for X axis or down for Y axis)
when the axis is at center
+1.0 when the axis is pushed to the "maximum" (right for X axis or up for Y axis)
But I get :
-1.0 when the axis is at center
when the axis is halfway between center and maximum
+1.0 when the axis is pushed to the "maximum" (right for X axis or up for Y
+1.0 if the axis is pushed at any position below center
I really don't understand why I get these values :
when I display the windows joystick calibration UI (run "joy.cpl") the joystick is working fine.
when I use an existent game, the joystick is working fine
I tried some joystick test programs found on the internet, each time the joystick is working fine
I tried some HTML5 joystick test sites, each time the joystick is working fine
But I can't believe there is such a problem in Unity5, so it must be in my code...
Here is a simple test code I use in Unity to display values :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class JoystickTest : MonoBehaviour
{
public float Position = 0.0f;
void Update()
{
float value = Input.GetAxis("Player 1");
Position = value;
}
}
And the Unity input manager is configured as follow :
I've tried to play with input manager settings, with windows joystick settings, with my code... no way, the result is still the same : work in any application except in my Unity test project...
On Google, I've found some post about the same problem, but no solution...
Any help will be really appreciated !
Thanks
Your answer
Follow this Question
Related Questions
Single Stick Controller Resets on Game Play 1 Answer
Player i spining when moving 0 Answers
how to map joystick for mobile game? 0 Answers
How to check if player is rapidly rotating the joystick? 2 Answers