Tp3 + start TP4
This commit is contained in:
parent
57a40d426b
commit
3a7ce962e7
112 changed files with 63386 additions and 45 deletions
23
TP3/Assets/Scripts/CameraThings/FollowTarget.cs
Normal file
23
TP3/Assets/Scripts/CameraThings/FollowTarget.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class FollowTarget : MonoBehaviour
|
||||
{
|
||||
[SerializeField] Transform target;
|
||||
[SerializeField]
|
||||
[Range(0f, 1f)]
|
||||
float lerpSpeed;
|
||||
|
||||
Vector3 offset;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
offset = transform.position - target.position;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void FixedUpdate()
|
||||
{
|
||||
transform.position = Vector3.Lerp(transform.position, target.position + offset, lerpSpeed);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue