- Home /
Problem getting "good-feeling" aiming with joysticks for a top-down shooter
Hello, I am currently making a 2v2 competitive game where each player can pick up and through stuff around. It takes place in 3D from an isometric perspective. here is a gyf of what it looks like and shows how jumpy the rotation is: https://gfycat.com/NegativeIllinformedIchthyosaurs
All of the aiming is done with the left stick, but it doesn't really feel great and sort of just snap between different angles instead of being a smooth 360 degrees. I'm having problems figuring out if it's a problem with either my actual controllers (all wireless 360 controllers), my code, or my input settings for the controllers.
This is the code that I use for aiming:
direction.x = 1f * Input.GetAxis("Horizontal");
direction.z = -1f * Input.GetAxis("Vertical");
lookAngle = new Vector3(direction.x, 0, direction.z);
Vector2 moveVec1 = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
if (moveVec1.sqrMagnitude >= deadZone) //deadzone =.1
{
this.transform.rotation = Quaternion.LookRotation(lookAngle);
}
I also use some code to smooth out the movement of the character model for aesthetic purposes which seems to actually help making the aiming smoother but it still feels like it's just moving between maybe "steps" and not actually giving me full 360 degree aiming.
the code for smoothing I use is this:
targetAngle = Quaternion.LookRotation(lookAngle);
targetAngle *= Quaternion.Euler(0, 90, 0); // used to making the "front" of the model look where the player is aiming
if(canMove)
{
if(!GetComponent<dashNShoot2>().pointer.GetComponent<grabber>().holding)
{
Quaternion newRotation = Quaternion.Lerp(this.transform.rotation, targetAngle, rotateSpeed * Time.deltaTime);
this.GetComponent<Rigidbody>().MoveRotation(newRotation);
}
else
{
Quaternion newRotation = Quaternion.Lerp(this.transform.rotation, targetAngle, rotateWhileHoldingSpeed * Time.deltaTime);
this.GetComponent<Rigidbody>().MoveRotation(newRotation);
}
}
For my input settings I have snap enabled, gravity at 10, deadzone at 0, and sensitivity at 1. I've done a lot of research and tried a lot of different solutions but none have really worked for me. I used this article as a reference.
Any advice or suggestions on how to make my aiming feel better would be greatly appreciated.