IT-Academy icon

CameraController

IT-Academy | PRO | 04/12/18 10:39:40 AM UTC | 0 ⭐ | 363 👁️ | Never ⏰ | []
C# |

370 B

|

None

|

0 👍

/

0 👎

using UnityEngine;
using System.Collections;
 
public class CameraController : MonoBehaviour {
 
    public GameObject player;
 
    private Vector3 offset;
 
    void Start ()
    {
        offset = transform.position - player.transform.position;
    }
    
    void LateUpdate ()
    {
        transform.position = player.transform.position + offset;
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎