Ok, going through my old questions and resolving them.
iTween is a very good way to do this however isn’t supported when it comes to exporting to Flash (which i am doing)
Alternatively i simply used unities built in animation to make it rotate between two angles at a certain speed and then you can script
to pause the animation when necessary etc.
Very old thread but thought I would add this as I spent to long trying to work this out, sorry if the code aint that good as I am fairly new at this but worked great for what I needed.
public Transform horizontalPivot;
public float maxPan = 0.0f;
public float maxTilt = 0.0f;
public float speed = 2.0f;
private float panSoFar = 0.0f;
private bool panBack = false;
private bool firstRotation = true;
// Update is called once per frame
void Update()
{
RotateCamera();
}
void RotateCamera ()
{
if (horizontalPivot && maxPan > 0) {
if (!panBack) {
horizontalPivot.Rotate(0, 0, (Time.deltaTime * speed));
panSoFar += Time.deltaTime * speed;
if (firstRotation) {
if (panSoFar >= maxPan) {
panSoFar = 0;
panBack = true;
firstRotation = false;
}
return;
} else {
if (panSoFar >= maxPan * 2) {
panSoFar = 0;
panBack = true;
}
}
} else {
horizontalPivot.Rotate(0, 0, -(Time.deltaTime * speed));
panSoFar += Time.deltaTime * speed;
if (panSoFar >= maxPan * 2) {
panSoFar = 0;
panBack = false;
}
}
}
}