Advertisement
LittleAngel

DontMove-Child

Jun 14th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class CameraController : MonoBehaviour {
  5.  
  6. public GameObject target;
  7. private Quaternion desiredRotation;
  8. private Vector3 offset;
  9.  
  10. void Awake () {
  11. desiredRotation = transform.rotation;
  12. offset = transform.position;
  13. }
  14.  
  15. void LateUpdate () {
  16. transform.rotation = desiredRotation;
  17. transform.position = target.transform.position + offset;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement