looking to pan camera around guitexture background

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 :frowning:

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.

This is a bit too complex for me to develop something myself, but I will suggest that you use the raw mouse input to ‘move’ the camera, rather than just setting the position each time.

found this. this works :slight_smile: http://wiki.unity3d.com/index.php?title=DraggableGUIElement