*
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class CameraFollow : MonoBehaviour {
|
||||
public Transform target;
|
||||
public Vector3 cameraOffset;
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
if(target != null) {
|
||||
cameraOffset = transform.position - target.position;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
if(target != null) {
|
||||
transform.position = target.position + cameraOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user