본문 바로가기
Programing/unity

유니티 ,unity.캐릭터 따라다니는 카메라

by 고니의 경제주식 2017. 2. 25.
반응형

//빈 오브젝트는 하나 생성하고 그안에 카메라를 넣고 빈오브젝트에 이 스크립트를 바인딩한다.


using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class cameramovie : MonoBehaviour {


public GameObject ch; // 인스펙터 창에서 캐릭터를 여기에 조인한다.

void Start () {

transform.position = ch.transform.position;  // 캐릭터 좌표를 카메라 좌표로 ..

}

// Update is called once per frame

void Update () {

transform.position = ch.transform.position;

}

}



반응형