When my player object is a certain amount away from the center of the screen, a script is enabled to move the camera to the player’s position, and it is only disabled when the camera is re-centered. This works when I change the camera’s position to the player’s position, but then it snaps to the player and I don’t want that. When I use “transform.translate”, the script makes the camera start slowly falling, with the player able to drag/float it around with their motion. The camera is never able to recenter like this, so the script is never disabled.
Edit: Here is my code. Like I said, it breaks when I change it to “transform.translate”
GameObject player;
void Start () {
player = GameObject.Find("Player");
}
void Update () {
transform.Translate(player.transform.position * Time.deltaTime);
}
The camera is a child of a transparent box that this script is attached to. The script is enabled when the player exits the box and disabled when the box re-centers to the player.