Hi,
I’v found several posts asking for a player to follow the camera rotation, but what I want is a camera (which is not a child of the player) always looking in the players direction.
With below script the camera follows the path of the player perfectly, but always looks in the same direction:
using System.Collections.Generic;
using UnityEngine;
public class CameraControler : MonoBehaviour {
public GameObject player;
private Vector3 offset;
public float speed;
// Use this for initialization
void Start () {
offset = transform.position - player.transform.position;
speed = 10;
}
// Update is called once per frame
void LateUpdate () {
transform.position = player.transform.position + offset;
}
}
Can someone help me with this?