Hi,
It is probably an easy problem that i cant see the solution, I worked on it along time and I cant see the problem.
I create an empty GameObject which called “Rotate Camera” put for him a script that called “Spincamera” and draged a GameObject that called “Main Camera”.
In “SpinCamera” I put this code:
using UnityEngine;
using System.Collections;
public class SpinCamera : MonoBehaviour {
//this script for moving circley around the table
public float RotateSpeed;
private float Spin;
private float ZoomSpeed;
private float StartedFieldOf;
private GameObject MainCemara;
bool IsPause;
// Use this for initialization
void Start () {
IsPause=false;
Spin=transform.rotation.y;
MainCemara=GameObject.Find("Main Camera");
StartedFieldOf=MainCemara.camera.fieldOfView;
ZoomSpeed=MainCemara.camera.fieldOfView/StartedFieldOf;
}
// Update is called once per frame
void Update () {
ZoomSpeed=MainCemara.camera.fieldOfView/StartedFieldOf;
Spin=-Input.GetAxis("Horizontal")*RotateSpeed*ZoomSpeed;
transform.Rotate(0,Spin,0);
}
}
now the problem is the “Rotate Camera” Object spins not only around himself, like he should to do,
It spins around the main camera too, which make alot of mess.
please help me…