Question by
HaBe1963 · Apr 08, 2017 at 09:58 AM ·
c#physicsplayer movementcamera rotate
Camera always facing players direction
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?
Comment
Your answer
Follow this Question
Related Questions
Roll a Ball Tutorial error 1 Answer
Ball Speed is not increasing as per code 0 Answers
Camera jitter when rotating player 0 Answers
How can we control two player objects at one time with RayCasting? 1 Answer
How to fix this problem? 1 Answer