I am changing our current pathfinding to A* Pathfinding Project. I have some questions. Our project needs following:
- The game is in 2D. We have 2D polygon colliders for obstacles (buildings and stuff)
- Game already generates graph node points. Those are made by creating a node point for every point in a 2D polygon collider that is expanded outward from the collider by fixed amount. This works very well.
- I want to add those points to the pointgraph from the code. I would prefer to just give positions, instead of needing to have transform, root or tag.
- After that I would like from code again, that the connections are calculated. If there is collider between two points, there is no connection.
- So far I have figured out following:
a) Add Pathfinder component to a GameObject
b) Add points using following slightly modified code that I found:
var graph = AstarPath.active.data.pointGraph;
foreach (Vector3 point in nodePositions)
c) I don’t know how now let the system calculate which nodes are connected to which?
Can anybody help me in the right direction?