Camera following player is jerky and has bad visual effect.
Hi i am beginner and have an issue with camera following the player which is jerky. i have a player with on tap moves only in upward direction and other enemies with moves in x direction. but when the player start jumping the camera start jerky movements and also has a bad effect on enemies movement too. Below is my code for CamerFollow.
public class CameraFollow : MonoBehaviour { [SerializeField] private float yMin; [SerializeField] private float yMax; [SerializeField] private float xMin; [SerializeField] private float xMax; private Transform target;
void Start () {
target = GameObject.Find("Player").transform;
//player = GameObject.FindGameObjectWithTag("Player");
}
void Update(){
}
// Update is called once per frame
void LateUpdate () {
transform.position = new Vector3 (Mathf.Clamp(target.position.x, xMin, xMax), Mathf.Clamp(target.position.y, yMin, yMax), transform.position.z);
if (Input.GetKeyDown(KeyCode.Escape)){
Application.Quit ();
}
}
}
Your answer
Follow this Question
Related Questions
No camera / images on Android build 1 Answer
Can not load the next scene 0 Answers
How to move character forward and also face moving direction ? 1 Answer
Unity Daydream Preview - Raycast/camera alignment 1 Answer
jni error has occurred local reference table overflow (max=512) Android crashes on start. 1 Answer