public void RefreshAutoRotate() { Camera cam = FollowCamera.GetCamera(); float current_angle = transform.rotation.eulerAngles.z; if (!cam.orthographic) { //Projection transform.rotation = Quaternion.Euler(cam.transform.rotation.eulerAngles.x, 0f, current_angle); transform.position = new Vector3(transform.position.x, transform.position.y, GetRotateZOffset()); } else { //Ortho transform.rotation = Quaternion.Euler(0f, 0f, current_angle); transform.position = new Vector3(transform.position.x, transform.position.y, 0f); } }
public void RefreshRender() { //Rotation if (auto_rotate) { Camera cam = FollowCamera.GetCamera(); if (!cam.orthographic) { transform.rotation = Quaternion.Euler(start_rot + Vector3.right * cam.transform.rotation.eulerAngles.x); transform.position = new Vector3(transform.position.x, transform.position.y, -rotate_offset * transform.lossyScale.y); } else { transform.rotation = Quaternion.Euler(start_rot); transform.position = new Vector3(transform.position.x, transform.position.y, 0f); } } }
void Awake() { _instance = this; cam = GetComponent <Camera>(); }