Camera don't follow sphere as was expected
Hello everyone, I'm creating a game, where camera follows sphere (sphere is being controlled by joystick, there I have no problem). Camera and sphere are children of general character gameobject and I put my controller script on it. I know if camera is a child of sphere, it would be rounding with sphere, so I created script that force camera to follow the sphere. There is my code: using System.Collections; using System.Collections.Generic; using UnityEngine; //Script was created because camera rotates with sphere if sphere is parent public class FollowCamera : MonoBehaviour { public float followspeed = 4f; public Transform target; public Vector3 offset = new Vector3(-0.56f, 2.51f, 3.4f); //set camera distance to sphere void Update() { CameraTransform(); } void CameraTransform() { transform.position = Vector3.Lerp(transform.position, target.position + offset, Time.deltaTime * followspeed); //transforms camera to character } }
As a result, camera follows sphere but camera is jumping while sphere is rounding. For more introduction of my problem, please look the video below.