UNITY 47

큐브 옮기기 게임 - Unity 3D

큐브를 지정된 장소에 옮기는 3D게임을 만들겠습니다. 1. Plan과 큐브로 맵을 만듧니다. 복잡할수록 어렵겠죠? 메테리얼을 만들어서 색도 입혀주세요. Project > 우클릭 > Creat > Material 3D 맞습니다. * 카메라 조정 위치이동시키고 회전 바꿔도 되지만 씬화면에서 보이는 모습으로 게임화면을 바꾸는 단축키 입니다. 카메라위치 Scen화면으로 바꾸는 단축키 : Ctrl + Shift + F. (Mec은 Command + Shift + F) 2. 플레이어 만들기 캡슐로 플레이어를 만들게요. 크기 조절하고 리기드바디랑 실린더 콜리더 넣어주시고 메테리얼 추가해서 색을 바꿔주세요. 큐브나 실린더로 만들면 넘어질일 없지만 캡슐이 귀여우니 캡슐로 할게요. 대신 리기드바디의 x,y축 회전을 막아 ..

UNITY/Unity Study 2023.09.06

문제 - Unity2D Tilemap Collider 2D 적용 불가

Tilemap Collider 2D Used By Composite 체크O Rigidbody 2D Body Type : Kinematic Simulated 체크O 나머지 컴포넌트 추가할 때 그대로 시도1 : Include Layers https://docs.unity3d.com/Manual/class-TilemapCollider2D.html Unity - Manual: Tilemap Collider 2D Tilemap Collider 2D The Tilemap ColliderAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape ..

UNITY 2023.09.01

시간내에 목적지 도달하기

1층에 도착하면 플레이어는 시간내에 3개의 현관문중 하나에 도달해야 합니다. 플레이어는 박스로 대체하고 무ㅔ스트 시작 전 3초 타이머를 만듧니다. 플레이어 이동 더보기 using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { public float moveSpeed = 15.0f; public bool canMove = false; public GameManager gameManager; // GameManager 스크립트 타입으로 변경 private void Update() { if (canMove) { Debug.Log("Move")..

UNITY/Unity Study 2023.08.30

유니티, 오큘러스 퀘스트2 연결하기 ( 사이드퀘스트 사용X )

사이드퀘스트 없이 오큘러스에서 제공하는 프로그램을 사용하겠습니다. 오큘러스 개발자로 등록해주세요 https://developer.oculus.com/manage/organizations/create/. Oculus Developer Center | Authenticate developer.oculus.com 오큘러스 앱을 설치하고(모바일 기기 가능) 아래 Sidequest 설치하기 중간에 있는 메타퀘스트 앱에서 개발자 모드 켜기를 참고하세요. https://www.meta.com/kr/ko/quest/setup/ Meta auth.meta.com https://ashen99.tistory.com/33 Sidequest 설치하기 1. 위에 링크에서 pc에 맞는 파일 다운 https://sidequestvr..

FurBall의 탈출기

https://assetstore.unity.com/packages/2d/characters/furball-2d-v1-2-mobile-optimized-40588 FurBall 2D V1.2 mobile optimized | 2D 캐릭터 | Unity Asset Store Elevate your workflow with the FurBall 2D V1.2 mobile optimized asset from Illustraktion. Find this & more 캐릭터 on the Unity Asset Store. assetstore.unity.com 귀여워서 이 애셋으로 만들거에요 사용할 오브젝트를 꺼내봤어요. -게임 내용은 발판밟고 올라가서 갇혀있는 친구 구하기 입니다. - Add 콜라이더 카메라랑 플..

UNITY/Unity Study 2023.08.23

화살피하기 Unity 2D

부엉이가 화살피하는 2D 게임을 만들거에요. 먼저 사용할 오브젝트를 꺼내주세요. 배경은 레이어 0, 부엉이랑 화살은 1로 할게 부엉이가 오른쪽 화살표를 누르면 오른쪽으로, 왼쪽화살표는 왼쪽으로 움직이게 하는 스크립트(OwlController.cs)를 부엉이 오브젝트에 추가해주세요 using System.Collections; using System.Collections.Generic; using UnityEngine; public class OwlController : MonoBehaviour { // Start is called before the first frame update void Start() { Application.targetFrameRate = 60; } // Update is call..

UNITY/Unity Study 2023.08.22

목적지까지 자동차 움직이기 Unity

사용할 객체를 인스펙터창에 옮겨주세요. 2D는 레이어 값이 높을 수록 위에 나타납니다. 예를 들어 도로의 레이어 값이 0이라면 도착지가 1, 자동차는 2로 해주세요 CarController.cs를 만들어 자동차에 넣어주세요 using System.Collections; using System.Collections.Generic; using UnityEngine; public class CarController : MonoBehaviour { float speed = 0; Vector2 startPos; // Start is called before the first frame update void Start() { Application.targetFrameRate = 60; } // Update is c..

UNITY/Unity Study 2023.08.21

유니티 문법

사용해본것 동작 순서 1. Awake : 씬이 로드될 때 씬의 각 오브젝트에 대해 호출됩니다. Start보다 먼저 동작합니다. 2. Start : 첫 프레임이나 오브젝트의 물리 업데이트 전에 호출됩니다. 3. Update : Start 이후에 매 프레임마다 반복 실행 4.LateUpdate : Update 함수에 이어서 호출되는 함수 정기 업데이트 이벤트 Update 함수는 프레임이 렌더링되기 전에 호출되고 애니메이션이 계산되기 전에도 호출됩니다. void Update() { float distance = speed * Time.deltaTime * Input.GetAxis("Horizontal"); transform.Translate(Vector3.right * distance); } * Time.de..

UNITY/Unity Study 2023.08.19

벡터 사이의 거리 구하기

위치가 변할 떄 void Update(){ // 위치 업데이트 Vector3 pos = transform.position; Vector3 dis = prevPos - pos; playerSc.newHP -= hp * dis.magnitude; prevPos = pos; } 값이 주어질 때 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Something : MonoBehaviour { void Start() { float distance = GetDistence(2, 2, 5, 6); Debug.Log("(2,2)에서 (5,6)까지의 거리 : " + distance..

UNITY/Unity Study 2023.08.19