Hello,
So I’ve been using cinemachine freelook for my game I’m building. Its a 3rd person camera. Now I recently switched my movement from character controller to rigidbody, and that’s when I started having jitter issues. Now I understand that rigidbody uses fixed update for updating the player movement. I’ve tried going though many of the different cine machine options and changing it between smart, fixed, and late update. I managed to get a almost perfect version, but there’s still small amounts of jitter when moving side to side. When I move straight forward or backwards, I have no issue. And the camera panning around during movement causes no issue as well. But when I start moving sideways, while facing forward, I get little jitter problem that is visible, and is annoying. This might be normal, and I’m just obsessing’s over nothing, so I’m looking for some help from anybody. Heres my current best cinemachine settings:
Here’s my player movement script:
void Update()
{
if (view.IsMine)
{
if (Input.GetMouseButtonDown(0))
{
ac.animator.SetTrigger("Attack");
}
isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
_inputs = Vector3.zero;
_inputs.x = Input.GetAxis("Horizontal");
_inputs.z = Input.GetAxis("Vertical");
_inputs.Normalize();
if (Input.GetButtonDown("Jump") && isGrounded)
{
rb.AddForce(Vector3.up * Mathf.Sqrt(jumpHeight * -2f * Physics.gravity.y), ForceMode.VelocityChange);
}
}
}
void FixedUpdate()
{
if (view.IsMine)
{
if (_inputs.magnitude >= 0.1f)
{
float targetAngle = Mathf.Atan2(_inputs.x, _inputs.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
transform.rotation = Quaternion.Euler(0f, angle, 0f);
_inputs = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
_inputs.Normalize();
}
rb.MovePosition(rb.position + _inputs * speed * Time.deltaTime);
}
}
Any help appreciated! I can post a video, but its hard to see the jitter if the video isnt 120 fps