Hi, I have a weird problem, not sure if it’s a bug.
I’m working with the new Input-System and needed the direction of my mouse and left analog-stick movement. Left or right or nothing.
So I get the Readvalue() from the Input-System. If the normalized value is more than 0 it moves right and if less than 0 it moves left and exactly 0 than no movement at all. At least, that’s how it should be.
When I’m using the controller, it works perfectly, but when I’m using the Mouse the Vector2 outputs two values at the same time.
I get the value of my movement, so either positive or negative, but also always a zero value. So when I’m checking if the input returns a Vector2.zero, it’s always true, even though I’m also getting the other value and it doesn’t know what should be true.
I tried so much. It also happens, when I’m getting the Input.GetAxis(“Mouse X”). The same thing.
The code is simplified and not one to one. Just for you to understand better.
private void InputFuction()
{
//Camera Movement
lookDir = _playerActions.Player.Look.ReadValue<Vector2>().normalized;
}
private void Update()
{
if(lookDir.x > 0)
{
//Should be right
}
else if (lookDir.x < 0)
{
//Should be left
}
else if (lookDir.x == 0)
{
//Should be nothing
}
Debug.Log("MouseMovement: " + lookDir.x);
}