I'm working on a first person shooter game.
My problem is that my Mouselook
script is shaky and jittery when I looking around.
Here is my code:
Transform MyTransform;
const string vert_input = "Mouse Y";
const string horz_input = "Mouse X";
public float mouseSensitivity = 100.0f;
public float clampAngle = 80.0f;
void Update()
{
the_time = Time.deltaTime;
ROTX_ROTY.y += (Input.GetAxis(horz_input) * mouseSensitivity * current_speed_offset * the_time);
ROTX_ROTY.x += (Input.GetAxis(vert_input) * mouseSensitivity * current_speed_offset_vertical * the_time);
ROTX_ROTY.x = Mathf.Clamp(ROTX_ROTY.x, -clampAngle, clampAngle);
MyTransform.rotation = Quaternion.AngleAxis(ROTX_ROTY.y, Vector3.up);
x_rot_transform.localRotation = Quaternion.AngleAxis(ROTX_ROTY.x, Vector3.left);
}
And this is my input settings for Mouse X
and Mouse Y
:
For more explanation: I put my camera inside one of my controller children and if I put it out of controller the issue is still there.
I tried Lerp
, Slerp
, smoothdamp
, euler
but does not make any difference.
I tried this script for Android and I used a touch instead of a mouse and the result was same.
I tried it on FixedUpdate
and the result was same.
Is there any way to fix this problem?
Here is a video about my problem.
horz_input
&vert_input
controls in the Input Manager, and the values of / any code modifying the sensitivity and current speed offset parameters? \$\endgroup\$ – DMGregory♦ Mar 28 '19 at 22:26