first commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraFollow : MonoBehaviour
|
||||
{
|
||||
public Transform target;
|
||||
public Vector3 offset = new Vector3(0f, 8f, -7f);
|
||||
public float followSpeed = 8f;
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 desiredPosition = target.position + offset;
|
||||
transform.position = Vector3.Lerp(transform.position, desiredPosition, followSpeed * Time.deltaTime);
|
||||
transform.rotation = Quaternion.Euler(58f, 0f, 0f);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user