Contents
Overview
GridGraph 에는 다양한 방식으로 노드를 수정할 수 있는 유연한 규칙 시스템이 있습니다. 예를 들어, 규칙은 노드 아래의 GameObject 레이어에 따라 노드에 태그를 적용하거나, 표면 경사에 따라 노드에 패널티를 적용할 수 있습니다.
GridGraph 인스펙터에서 "Add Rule" 버튼을 클릭하여 새로운 규칙을 추가할 수 있습니다.
사용 가능한 규칙은 다음과 같습니다:
- Penalty from slope angle
- Penalty from elevation
- Per layer modifications
- Texture (set the penalty and walkability based on a texture)
Adding rules using a script
스크립트를 통해 규칙을 추가할 수도 있습니다:
```csharp
// 예제 코드
```
// 씬에서 첫 번째 그리드 그래프를 가져옵니다.
var gridGraph = AstarPath.active.data.gridGraph;
gridGraph.rules.AddRule(new Pathfinding.Graphs.Grid.Rules.RuleAnglePenalty {
penaltyScale = 10000,
curve = AnimationCurve.Linear(0, 0, 90, 1),
});
Writing Custom Rules
자신만의 그리드 그래프 규칙을 작성하려면 다음을 참조하십시오: Writing Custom Grid Graph Rules.
'유니티 에셋 > A* Pathfinding project pro' 카테고리의 다른 글
Using nodes (0) | 2024.05.27 |
---|---|
Grid Graph Rules > Writing Custom Grid Graph Rules (0) | 2024.05.26 |
Graph Updates during Runtime (0) | 2024.05.26 |
Using navmeshes (0) | 2024.05.26 |
Graph Types (0) | 2024.05.26 |