using System.Collections.Generic;
using UnityEngine;
public class TouchMovement : MonoBehaviour
{
// 2d smooth horizontal drag system for mobile and mouse
public float dragSpeed = 2;
private Vector3 dragOrigin;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
dragOrigin = Input.mousePosition;
return;
}
if (!Input.GetMouseButton(0)) return;
Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition - dragOrigin);
Vector3 move = new Vector3(pos.x *- dragSpeed, 0, 0);
transform.Translate(move, Space.World);
}
}
this is my camera movement in my cinemachine virutal camera put when i add Cinemachine Confiner 2D and set a limtis to it , the cinemachine brain goes beyond it limtis but the camera stays the (X) value , so it my problem is when i try to go to the edge of the limtis it keeps on and goes beyond the mean the virtual camera but so when it try to get back of the limits i wait the virtual camera Wait for it to catch up .