Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public GameObject lookAt;
  2.  
  3. private bool smooth = true;
  4. private float smoothSpeed = 0.07f;
  5. private Vector3 offset = new Vector3 (0f, 3.5f, -6.5f);
  6.  
  7. void FixedUpdate()
  8. {
  9. // THIS LINE CAUSES THE ERROR.
  10. Vector3 desiredPosition = lookAt.transform.position + offset;
  11.  
  12. if(smooth)
  13. {
  14. transform.position = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed);
  15. }
  16. else
  17. {
  18. transform.position = desiredPosition;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement