Moving the Camera

Проверено с версией:: 5

-

Сложность: Базовая

Moving the camera relative to the player.

Moving the Camera

Базовая Roll-a-ball tutorial

Транскрипты

CameraController

Code snippet

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;
    }
}

Связанные обучающие материалы