Hi. Note: Not being maintained by me, it was just an experiment for learning unity and c# concepts. (I may publish a complete package for this manner in future)
For example, if the follower has the path of A, B, C and D, and is starting at A and the target is C, When the user is at A, he can pass the B and go to C instead, so simply pass the Node you don’t want to move through.
Good is it possible to tell the follower to read the nodes tag? like giving the Follower a string list called ( enabled tags ) if the node’s tag is not added in this list the Follower will not pass through it, he should make the shortest path only through the nodes that is added in the enabled tags list
Yes, it is possible, you have full access to the whole game object properties, components and etc.
Open the Follower.cs file and take a look at FollowPath coroutine:
IEnumerator FollowPath ()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.update += Update;
#endif
var e = m_Path.nodes.GetEnumerator ();
while ( e.MoveNext () )
{
m_Current = e.Current;
// Wait until we reach the current target node and then go to next node
yield return new WaitUntil ( () =>
{
return transform.position == m_Current.transform.position;
} );
}
m_Current = null;
#if UNITY_EDITOR
UnityEditor.EditorApplication.update -= Update;
#endif
}
The m_Current is the current Node, and you can access the GameObject via m_Current.gameObject like other component associations.
This feature seems to be a good addition, I have plan to make this pathfinding more familiar with unity and add extra components and features.
Hi I’m trying to change the size of the connections from 1 to 3 in the nodes, but it keeps going back to 1 element. I would like to have three different nodes being connected to the one node, but it won’t let me. What should I do? Thanks in advanced.
Hi.
For example, for connecting node A to node B you need to add node B to node A connections list and do the same thing in node B side to make an two-way connection.
Also, as you can see in the Image above, three different nodes are connected to node E.
Anyway, if you provide more information I can do more to help you.
Hope this helps.
If you have any further questions or help request, just let me know.
Thanks.
Yes, I am planning to implement A* too, but there are some implementations already available for Unity, anyway, I will create an implementation by myself, but I can’t provide any specified time or any time soon.
First off unity’s navmesh is pre-baked. You can’t recalculate the graph at runtime.
Also, Unity’s system is mesh based instead of node based. This is fine for open 3d worlds. But can be very limiting for 2d games, if even useful at all. And it also can make for some odd shaped graph paths without averaging.
Sort of. But the built in system has some severe limitations. It’s not really practical for anything other then straight forward navigation on a Navmesh.
These two different system don’t have any relation to each other and there is no need they work together, because their purpose is different from each other.