When my player moves, moving the camera looks like the camera is teleporting to the player, and then after loading teleporting again. I want to make it move smoothly.
When the camera is following the player position, it is moving smoothly.
Camera following code:
private void Update()
{
Vector3 position = GetFollowingPoint();
position = new Vector3(
Mathf.Clamp(position.x,
Bounds.bounds.min.x + Camera.orthographicSize * Screen.width / Screen.height,
Bounds.bounds.max.x - Camera.orthographicSize * Screen.width / Screen.height),
Mathf.Clamp(position.y,
Bounds.bounds.min.y + Camera.orthographicSize,
Bounds.bounds.max.y - Camera.orthographicSize),
transform.position.z);
transform.position = position;
}
GetFollowingPoint():
return Player.transform.position + (cursor.transform.position - Player.transform.position) / 3;
Player movement: rigidbody.velocity = Vector in FixedUpdate(), Input with Input.GetKey() and Vector += Vector2.up/down/left/right.
Interpolation in Rigidbody set to Interpolate.