The problem I’m having is that when I move the camera on the x Axis it moves according to the world. Is there a function to move it on its local x so that I can make it circle around the player. I can’t find anything in the scripting reference. I’ve already come up with different ways to make a 3rd person camera work but before I try to check those I want to save time by using this way.
var hero : GameObject;
var height : float;
var distance : float;
function Start ()
{
hero = GameObject.FindWithTag("Player");
}
function Update ()
{
transform.position.y = hero.transform.position.y + height;
transform.position.z = hero.transform.position.z - distance;
transform.LookAt(hero.transform);
if (Input.GetAxis("CamSide") < 0)
{
transform.position.x -= 2 * Time.deltaTime;
}
if (Input.GetAxis("CamSide") > 0)
{
transform.position.x += 2 * Time.deltaTime;
}
}