문제 설명
걸을 수 있는 타일 위에 있는 장애물 사이의 길 찾기 (Pathfinding between obstacles that sit on top of walkable tiles)
아래 사진을 예로 들어 보겠습니다. 다음을 고려하십시오. ‑
- 파란색 사각형은 플레이어입니다.
- 주황색 사각형은 첫 번째 대상입니다.
- 분홍색 사각형은 두 번째 대상입니다.
- 녹색 사각형은 걸을 수 있는 타일입니다.
- 검은색 사각형은 걸을 수 있는 타일 위에 있는 벽/장애물입니다.
- 각 타일은 4x4입니다.
여기서 의도한 동작은 다음과 같습니다. ‑
- 주황색 사각형으로 걸어가면 직선 아래로 직선이 나타납니다.
- (파란색 사각형에서) 분홍색 사각형으로 걸어가면 가까운 거리에 있는 검은색 사각형 주위를 걷습니다.
현재 구현에서는 타일 그리드를 가져와서 일반적인 A* 알고리즘에 전달합니다. 각 사각형에 대한 최단 경로. 그러나 타일에 벽이 있다고 해서 걸을 수 없다는 의미는 아닙니다. 생성된 경로가 개체를 통해 잘리지 않는다는 것을 의미해야 합니다.
즉, 현재 구현 결과는 다음과 같습니다. 4x4 타일 그리드에 고정하는 것 외에는 선택의 여지가 없으며 전체 타일을 걸을 수 없는 것으로 표시하지 않으면 개체를 통해 잘립니다. 빨간색 타일은 걸을 수 없습니다.