etc-posts/Unity :: C# 튜토리얼

    [유니티C#][기초] 2. 특정 오브젝트를 카메라가 따라오가게 하기

    123456789101112131415161718192021222324252627using System.Collections;using System.Collections.Generic;using UnityEngine; public class CameraFollow : MonoBehaviour{ public Transform target; public float speed = 5f; private Vector3 offset; public void Awake() { //결국은 화살표가 나를 가르키겠끔 하도록 Player -> 카메라 의 방향을 구해 offset = transform.position - target.position; } public void Update() { //최종위치가 정해지겠지 var ..

    [유니티C#][기초] 1.유니티로 마우스 키보드 입력 받기

    12345678910111213141516171819202122232425262728293031323334353637 using System.Collections;using System.Collections.Generic;using UnityEngine;//1. Awake 깨워 -> 2. Start 시작 ->3. FixedUpdate()/Update() 물리틱/틱 함수public class PlayerControler : MonoBehaviour{ public float speed = 15f; private Rigidbody rb; public void Awake() { //유니티상에서 rigid추가하면 new한 셈 , 그 주소를 가져옴 rb = GetComponent(); } public void Fi..