I’m trying to set up a camera to ‘pan’ line in a graphics program. I started with this…
public float dragSpeed = 1f;
private Vector3 dragOrigin;
if (!Input.GetMouseButton(0)) return;
Vector3 pos = cam.ScreenToViewportPoint(Input.mousePosition - dragOrigin);
Vector3 move = new Vector3(pos.x * dragSpeed, 0, pos.y * dragSpeed);
transform.Translate(move, Space.World);
but it is ‘spongy’, there is a disconnect between the camera and the mouse. I would like a 1 to 1 relationship between the camera and the mouse. Can someone point me in the right direction? Thanks.