I know this is asked a lot but I’ve been through a ton of these threads and still cannot seem to get my camera nice and smooth. I’ve tried various methods.
As of now here are my codes…
My player movement is as follows (you can only move left and right):
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, 0.0f);
rb.AddForce (movement * speed);
}
This is my favorite type of camera movement (as far as how I want it to work goes), but is super choppy, mostly when the player is going far right or far left (like holding down left or right so the player is on the edge):
void LateUpdate () {
Vector3 velocity = Vector3.zero;
transform.position = Vector3.SmoothDamp(transform.position, GameObject.Find("Player").transform.position + offset, ref velocity, 0.03f);
transform.rotation = Quaternion.Euler(0f,0f, (velocity.x/-10));
}
This one seems to be a bit smoother but is STILL not perfectly smooth (and doesn’t have the nice x rotation but I haven’t written it yet) - the problem still arises when the player is going hard left/right:
void LateUpdate () {
transform.position = Vector3.Lerp(transform.position, GameObject.Find("Player").transform.position + offset, 20f * Time.deltaTime);
}
My player is set to Interpolate, I tried setting my application to 60fps, I’ve tried many of the scripts I’ve found and I just cannot get a perfectly smooth camera. It always gets choppy when the player is moving hard left or right (when the player is on the edge and can no longer move right within the field of view) while the camera follows.
I’ve put the camera as a child of the player with no script attached and it is perfectly smooth so I don’t believe the problem to be the player movement.
Any help would seriously be great! I’m a little frustrated I can’t figure this out but it seems other people have their scripts mostly fixed when they put the camera script in LateUpdate.
Thanks so much for reading! I know this is probably annoying to have yet ANOTHER smooth camera follow question so I do apologize for that!