# 2D

## Platformer

<figure><img src="/files/8XTvQQ2BDP0nF6yWpuwp" alt=""><figcaption></figcaption></figure>

코드 : <https://gist.github.com/SeizeTheDay7/13fe2730f97f8d0c5d0a0a3658ea672b>

* 조절 가능한 raycast로 플레이어 양 옆에서 ground check
* Blend Tree로 Idle, Walk, Run 애니메이션 처리
* 추가할 것: Coyote Time, Jump Buffer

## Topdown

<figure><img src="/files/s8ecFabd7IFGIMnExRUe" alt=""><figcaption></figcaption></figure>

코드 : <https://gist.github.com/SeizeTheDay7/0a72b4b05623fb08a513af7f97117840>

## Isometric

2D

* unity 자체 isometric tilemap 사용하거나 직접 만들 수도 있긴 함
* 애니메이션 만들 때 8축 다 그려야 해서 오래 걸림
* 넓은 물체 sorting 문제 생김

3D

* 2D에 비해 디테일 그리는거 어렵고 오래 걸린다
* 애니메이션 쉽게 만들 수 있다

2D + 3D

* 가장 좋다. 애니메이션 필요하면 3D로, 디테일 필요하면 2D로.
* collider를 직접 설정해줘야 해서 번거로울 수 있다

한 칸의 크기 (PPU)는 가로 기준 그려진 한 면에서 가로와 세로를 찾아 Cell Size 비율을 설정 Sprite Editor에서 Slice할 때 Isometric이 아니라 Rectangle로 하는 것 분명 Multiple Rectangle로 잘랐는데 모양이 다이아 모양이 됐다면 파일 지우고 다시

<figure><img src="/files/W2nFv3SdUGiXQ61eCCPH" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/luAm8Magzu2sdfMFSOOQ" alt=""><figcaption></figcaption></figure>

코드 : [https://gist.github.com/SeizeTheDay7/cf3f9f63f7fc295dddcd10bd5be511bf ](https://gist.github.com/SeizeTheDay7/cf3f9f63f7fc295dddcd10bd5be511bf)

참고할만한 영상 : <https://www.youtube.com/watch?v=_TY0F7Zm6Lc>

문제

* 방향키로 조작하면 대각선으로 이동 끝내려고 해도 마지막 남은 방향키가 하나라 동서남북 직선 방향 Idle 애니메이션이 재생됨.
  * 입력 버퍼를 넣으면 빠르게 방향 전환할 때 어색한 문제 발생
  * 이동 버퍼를 넣으면 조작감이 답답해지는 문제 발생
  * 애니메이션을 update가 아니라 fixedupdate에 넣으면
* 마우스로 클릭하면 해당 위치로 가는 이동법 도 많은 Isometric 게임에서 채용됨. 하지만 navmesh는 3D가 기준.
  * 억지로 2D에 3d collider 추가해서 쓰거나, 외부 라이브러리 가져와서 써야됨

향후에 진짜로 필요해지면 더 고민해보기

근데 애초에 Isometric 할거면 강도가 총 겨누지 않는 이상 3D 기반으로 만드는게 맞는 거 같다 NavMesh도 안되고 collider 지정도 곤란하고 애니메이션도 힘들고 튜토리얼이 괜히 없는게 아님


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lazyartisan.gitbook.io/note/main-page/r-and-d/movement/2d.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
