Set the rotation axis of the camera
I figured out how to make my camera rotate, but i need its axis of rotation to be the player. Here's my code:
using UnityEngine;
using System.Collections;
public class CameraController : 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 LateUpdate () {
transform.position = player.transform.position + offset;
transform.rotation = player.transform.rotation;
transform.Rotate (new Vector3 (45, 00));
}
}
What can I do to fix this? Any suggestions?
2016-03-18-20-33-55-01.jpg
(372.4 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612072423im_/https://answers.unity.com/themes/thub/images/avi.jpg)