Hi,
I have this code which has some strange results:
if(isPanning && Input.GetMouseButton(0)) //panning
{
Ray mouseSyncRay1 = Camera.main.ScreenPointToRay(Input.mousePosition);
Physics.Raycast(mouseSyncRay1, out mouseSyncHit);
Debug.DrawLine(mouseSyncRay1.origin, mouseSyncHit.point, Color.red);
targetPanPos = mouseSyncHit.point - cameraHolder.transform.position;
cameraHolder.transform.position = Vector3.Lerp(cameraHolder.transform.position, targetPanPos, Time.deltaTime * 2f);
}
The idea was to raycast onto my scene to see where the mouse is, in projection, and move the camera there. However, if I click and keep my mouse there, the camera always under/overshoots. Any idea how to make the camera move exactly to where the mouse is? Considering this code is in update.