offset
-
[Roll-a-Ball]CameraController 스크립트Unity(유니티) 2022. 4. 13. 13:17
offset : 동일 오브젝트 안에서 오브젝트 처음부터 주어진 요소나 지점까지의 변위차를 나타내는 정수형 시작 시 카메라와 플레이어의 위치 값을 뺀 후 offset에 저장하고 LateUpdate를 통해 이동 및 나머지 Update를 진행 후 함수를 실행하여 카메라의 위치 값을 player의 이동한 위치와 offset 값을 더해 player와 일정하게 거리를 위지하며 이동할 수 있도록 함 using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraController : MonoBehaviour { public GameObject player; private Vector3 offset; // ..