Hey so this is my script
============================================
#pragma strict
var object : GameObject;
function OnGUI () {
//Camera pan left
if (GUI.RepeatButton(Rect(Screen.width/1.25 - (Screen.width/10)/2, Screen.height/15 - (Screen.height/10)/2, Screen.width/4.3, Screen.height/26), "Pan Left")) {
transform.RotateAround(object.transform.position, Vector3.up, 8 * Time.deltaTime);
}
//Camera pan right
if (GUI.RepeatButton(Rect(Screen.width/1.25 - (Screen.width/10)/2, Screen.height/9.5 - (Screen.height/10)/2, Screen.width/4.3, Screen.height/26), "Pan Right")) {
transform.RotateAround(object.transform.position, Vector3.down, 8 * Time.deltaTime);
}
//Camera pan up
if (GUI.RepeatButton(Rect(Screen.width/1.25 - (Screen.width/10)/2, Screen.height/7 - (Screen.height/10)/2, Screen.width/4.3, Screen.height/26), "Pan Up")) {
transform.RotateAround(object.transform.position, Vector3.right, 6 * Time.deltaTime);
}
//Camera pan down
if (GUI.RepeatButton(Rect(Screen.width/1.25 - (Screen.width/10)/2, Screen.height/5.5 - (Screen.height/10)/2, Screen.width/4.3, Screen.height/26), "Pan Down")) {
transform.RotateAround(object.transform.position, Vector3.left, 6 * Time.deltaTime);
}
}
================================================
so it pans left and right fine, but lets say i pan halfway around the object, and then pan up or down, it still rotates around the x axis, so it looks like the map is tilting on its side. Any help?
Oh and I tried making the “object” in this script LookAt the camera, because that would make the x axis always perpendicular to the camera’s LoS, but for some reason I still have the issue.