Hi
I was expanding on the Roll-A-Ball Unity tutorial, and I decided that I wanted to make the camera rotate around the player when they move, so that the camera is always facing in the direction of the player. When I went to use RotateAround, instead of rotating around the player’s axis, the camera just rotated on it’s own axis, as if I was just using Rotate. Here’s my code:
using UnityEngine;
using System.Collections;
public class _Camera : MonoBehaviour {
public GameObject player;
private Vector3 offset;
// Use this for initialization
void Start ()
{
offset = transform.position - player.transform.position;
}
// Update is called once per frame
void Update ()
{
transform.position = player.transform.position + offset;
transform.RotateAround (player.transform.position, Vector3.up, Input.GetAxis ("Horizontal"));
}
}