I am making a 3d twin-stick shooter.
This is the code I use for looking with a right stick in FixedUpdate:
//process aim player input
float aimHorizontal = Input.GetAxisRaw("Horizontal2");
float aimVertical = Input.GetAxisRaw("Vertical2");
var lookDirection = new Vector3(aimHorizontal, 0, aimVertical);
if (lookDirection != Vector3.zero)
{
transform.LookAt(transform.position - lookDirection, Vector3.up);
}
Everything works, but the player keeps “snapping” to vertical and horizontal looking directions (you can see this in video - https://www.youtube.com/watch?v=zLOm89RWZX0 ).
How can I avoid this? The xbox gamepad I use itself seems fine, games like “Ruiner” does not seem to suffer from this issue. I tried using both GetAxisRaw and GetAxis and didn’t see any changes.