Advertisement
Guest User

Camera

a guest
May 25th, 2018
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. public Transform target;
  2.     public float smoothSpeed;
  3.     public Vector3 offset;
  4.     public bool ignore;
  5.  
  6.     void Start()
  7.     {      
  8.         target = GameObject.Find("redPlayer").GetComponent<Transform>();      
  9.     }
  10.  
  11.     void LateUpdate ()
  12.     {
  13.         Vector3 desiredPosition = target.position + offset;
  14.         Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed * Time.deltaTime);
  15.         transform.position = smoothedPosition;
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement