I recently used a script which rotates, zoom in and zoom out around a target. Unfortunately, I haven’t retrieved this script and all the camera scripts I’ve found (standard assets or others) only include the rotation.
Does somebody has a link or a script available which would infinitely rotate and zoom around a target?
Might I ask why you’re not trying to create such a script yourself? It’s not really hard, and I’m sure you’ll learn a few things along the way, rather than just with using a premade script.
Here is a script i just wrote for you, hope it helps.
FYI, it took me 20 minutes and i consider myself to be a beginner at C#.
using UnityEngine;
using System.Collections;
public class Camera_Rotate_Zoom : MonoBehaviour {
// Camera Target
public GameObject Target;
// Axis for rotation
public int Axis_X;
public int Axis_Y;
public int Axis_Z;
public int SpeedRotation;
// How ZoomedOut and In you want your FOV
public int FOV_ZoomIn;
public int FOV_ZoomOut;
// Speed of the zoom : float Between 0 and 1
public float SpeedZoom;
public int TimeBetweenZooms;
private bool IsZoomed = false;
IEnumerator ZoomingIn(){
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, FOV_ZoomIn, SpeedZoom);
yield return new WaitForSeconds(TimeBetweenZooms);
IsZoomed = true;
Debug.Log("Zoom IN");
}
IEnumerator ZoomingOut(){
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, FOV_ZoomOut, SpeedZoom);
yield return new WaitForSeconds(TimeBetweenZooms);
IsZoomed = false;
Debug.Log("Zoom OUT");
}
// Update is called once per frame
void Update () {
transform.RotateAround (Target.transform.position,new Vector3(Axis_X, Axis_Y, Axis_Z),SpeedRotation );
Debug.Log(Vector3.Distance (transform.position, Target.transform.position));
if(IsZoomed == false){
StartCoroutine("ZoomingIn");
Debug.Log("Zoom IN");
} else if(IsZoomed == true){
StartCoroutine("ZoomingOut");
Debug.Log("Zoom OUT");
}
}
}