랭귀지/Unity
유니티 점프시 카메라이동
유키공
2018. 4. 2. 09:00
플레이어가 점프를 하면 카메라는 일정 거리만큼 이동되고 정지합니다.
플레이어가 떨어질때는 카메라 이동은 없습니다.
void Update () {
MoveCamera();
}
void MoveCamera()
{
if(transform.position.y > maxY)
{
maxY = transform.position.y;
//카메라 위치 이동
Camera.main.transform.position = new Vector3(0, maxY - 2.5f, -10);
score = maxY * 1000;
}
}