20 lines
525 B
C#
20 lines
525 B
C#
using UnityEngine;
|
|
|
|
namespace Scampz.GameJam
|
|
{
|
|
public class CameraFollow : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Vector3 cameraOffset;
|
|
[SerializeField]
|
|
private float _cameraYPosition = 45f;
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
var player = GameObject.FindGameObjectWithTag("Player");
|
|
var lockedInYPosition = new Vector3(player.transform.position.x - cameraOffset.x, _cameraYPosition, player.transform.position.z - cameraOffset.z);
|
|
transform.position = lockedInYPosition;
|
|
}
|
|
}
|
|
}
|