Advertisement
LittleAngel

LateUpdate Camera

Sep 6th, 2012
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CameraController : MonoBehaviour {
  5.  
  6. public Transform playerTransform;
  7. private Vector3 offset;
  8. private Transform thisTransform;
  9.  
  10. // Use this for initialization
  11. void Start () {
  12. thisTransform = this.transform;
  13. offset = new Vector3 (thisTransform.position.x, 0.0f, thisTransform.position.z);
  14. }
  15.  
  16. // Update is called once per frame
  17. void LateUpdate () {
  18. thisTransform.position = playerTransform.position + offset;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement