I made a simply follow script with a switch to change the position of the camera to any of those four positions but I don’t like the result, now I want to make a rotate/Orbit the camera through these four positions, think of this four positions as South, west, east and north of the orbit camera, The regular orbit camera don’t suit my needs.
To illustrate the difference I made a comparison image, both camera script have the same angle (45º) and roughly the same distance, yet the orbit camera offers zero visibility in comparison.
This is my script as of now, those four positions are in the cases I use to change between them, I want to turn this into and orbit camera
using UnityEngine;
using System.Collections;
public class cameraFollow : MonoBehaviour {
public GameObject doke;
public Vector3 rotationoffset;
public float offset;
public float height;
private int procams = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void LateUpdate () {
if (Input.GetButtonDown("Fire2") == true){
procams += 1;
}
switch (procams){
case 4:
procams = 0;
break;
case 3:
//westest position
transform.position = new Vector3 (doke.transform.position.x +offset, doke.transform.position.y + height,doke.transform.position.z );
transform.localEulerAngles = new Vector3 (rotationoffset.x , 270,rotationoffset.z);
break;
case 2:
//norhtest position
transform.position = new Vector3 (doke.transform.position.x , doke.transform.position.y + height,doke.transform.position.z +offset);
transform.localEulerAngles = new Vector3 (rotationoffset.x , 180,rotationoffset.z);
break;
case 1:
//eastest position
transform.position = new Vector3 (doke.transform.position.x -offset, doke.transform.position.y + height,doke.transform.position.z );
transform.localEulerAngles = new Vector3 (rotationoffset.x , 90,rotationoffset.z);
break;
case 0:
//southest position
transform.position = new Vector3 (doke.transform.position.x , doke.transform.position.y + height,doke.transform.position.z -offset);
transform.localEulerAngles = rotationoffset;
break;
}
}
}
If you are thinking I could just add offset (like my cam does) to the orbit camera I already tried that, didn’t work, the orbit center was displaced.