Hi,
I’m using Unity 2023.2.18f1 with Cinemachine 2.9.7
I have a 3rd person controller with a character controller. Everything is set to FixedUpate but the camera rotation is jittering massively.
My Player Animator Setting:
My cinemachine brain:
Camera settings:
My camera script:
private void FixedUpdate()
{
// character aiming
bool isAiming = Input.GetMouseButton(1);
animator.SetBool(isAimingParam, isAiming);
directRotation();
}
void directRotation()
{
x = Input.GetAxis("Mouse X") ;
// invert Y Axis
if(yAxis.m_InvertInput)
{
y += Input.GetAxis("Mouse Y") ;
} else
{
y -= Input.GetAxis("Mouse Y") ;
}
y = 0;
y = Mathf.Clamp(y, minYRotation, maxYRotation);
cameraLookAt.localEulerAngles = new Vector3(y * turnSpeed * Time.fixedDeltaTime, x * turnSpeed * Time.fixedDeltaTime, 0);
float yawCamera = mainCamera.transform.rotation.eulerAngles.y;
if (!playerScript.dead)
{
transform.eulerAngles = new Vector3(x, yawCamera, 0);
}
}
cameraLookAt is a child of my player and it’s set as follow and look at in the camera.
Before I wrote this script I had a camera rotation with a Quaternion.Slerp for the player transform rotation, but then I had this kind of rubberband effect that I don’t want.
I like to move the mouse to rotate the view and the character for aiming. The character has a strafe animation.
Any idea about the problem?
thanks in advance
Frank


