There is a certain area ("Map") on which certain objects are scattered, between the objects there are several objects of points (indicator of the path, the number of points is different). The ship object moves along this path. How can I make a smooth movement of the camera along with the movement of the ship object (He, to my sadness, only "teleports" points)
Ideally, how to make a smooth movement of both ship and camera
The following code is available:
StartCoroutine(movement()); public IEnumerator movement() { var cam_top_y = Camera.main.transform.position.y - Camera.main.orthographicSize; var cam_bottom_y = Camera.main.transform.position.y + Camera.main.orthographicSize; foreach (Transform item in movement.points_active.transform) { ship.transform.position = item.transform.position; break; } ship.SetActive(true); yield return new WaitForSeconds(1.3f); movement.points_active.SetActive(true); foreach (Transform item in movement.points_active.transform) { item.gameObject.SetActive(true); ship.transform.position = item.position; /*if ((cam_top_y > sca.MaxY) && (cam_bottom_y < sca.MinY)) { cam.transform.Translate(0, item.transform.position.y, 0); }*/ yield return new WaitForSeconds(0.1f); } yield return null; }