i have a guitexture as a background for 2d, and am looking to pan around a 4096x4096 image background with the camera set to 1024x768. I tried to add a script to the background but haven’t had success
void OnMouseDown () {
Debug.Log(pos);
// min{x=0 y=-4.333} max{x=-3 y=0} x= * 0.000732421875 y= * 0.001057861328125
neither work below
pos.x = Mathf.Clamp(Input.mousePosition.normalized.x, 0, -3);
pos.y = Mathf.Clamp(Input.mousePosition.normalized.y, -4.333f, 0);
pos.x = Input.mousePosition.x * 0.000732421875f;
pos.y = Input.mousePosition.y * 0.001057861328125f;
transform.position = pos;
}
any ideas. I want to keep in bounds of the background.