Unity - limiting camera movement
0
I have 2D project and I want to be able move camera by touch to the right and back... I found one tutorial, moving camera with swipes so it is working fine but how can I set maximum distance to move camera? using System.Collections; using System.Collections.Generic; using UnityEngine; public class TouchController : MonoBehaviour { float touchStart = 0f; Vector3 cameraDestination; public float cameraSpeed = 0.1f; Camera m_MainCamera; // Use this for initialization void Start() { cameraDestination = Camera.main.transform.position; } // Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { touchStart = Input.mousePosition.x; } if (Input.GetMouseButtonUp(0)) { float delta = Input.mousePosition.x - touchStart; if (d...