2022-12-01 09:03:46 +01:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class CameraController : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public GameObject player;
|
2023-01-31 13:17:30 +01:00
|
|
|
public Camera camera;
|
2022-12-01 09:03:46 +01:00
|
|
|
private Vector3 offset;
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2023-01-31 13:17:30 +01:00
|
|
|
offset = camera.transform.position - player.transform.position;
|
2022-12-01 09:03:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LateUpdate()
|
|
|
|
|
{
|
2023-01-31 13:17:30 +01:00
|
|
|
camera.transform.position = player.transform.position + offset;
|
2022-12-01 09:03:46 +01:00
|
|
|
}
|
|
|
|
|
}
|