So here’s the scenario, when the player enters this trigger, the game object (the camera) needs to just move its position back by 5.
This script isn’t attached to the camera, only a game object with a box collider on it.
Im not sure if vector3.lerp makes sense to use, and I’m having issues writing its correctly. Here is my script so far.
public class MoveCamera : MonoBehaviour {
public GameObject _camera;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D (Collider2D other) {
if (other.gameObject.tag == "Player") {
Debug.Log ("move camera to new position");
//right here i need to move the camera from its original position back 5 (original position is -10, so it would be -15)
}
}
void OnTriggerExit2D (Collider2D other) {
if (other.gameObject.tag == "Player") {
Debug.Log ("return to normal camera position");
// right here it would return to normal, but i want to be able to move the camera individually from this script.
}
}
the position of the camera needs to still be following the player, and still needs to return to its regional position after exiting. Any know what I should look into for this?