29 Outubro 2016, 11:25 • João Miguel Dias
"There are some nodes that are not inside any Cluster. What should we do?"
This is a fault of the level designer (me). Since the clusters were created manually, the level designer should have guaranteed that all nodes have a corresponding cluster (i.e. there is no area in the Navmesh that is not inside a cluster).
To solve this problem there a couple of alternatives.
a) Do the level designer's work properly. This corresponds to checking all nodes not inside the clusters, and then readjusting the near clusters to cover them. I do not recommend this approach.
b) Simple approximation. In the case of a node that is not inside a cluster, return the cluster that is closest to him.
c) Ignore those nodes (since its not your fault anyway). The cluster is used only for the gateway heuristic. So if one of the nodes does not have a cluster (i.e. is null) when determining the gateway heuristic, just use the traditional euclidean distance.
- However, if you do this do not use == to compare a cluster with null. Unity developers decided to change the semantics of the == operator for Unity objects (a very bad idea in my opinion). Use for instance object.ReferenceEquals(null,startCluster) instead. The ReferenceEquals method is the default == operator for objects and cannot be redefined.
20 Outubro 2016, 17:29
18 Outubro 2016, 13:41
17 Outubro 2016, 13:35
16 Outubro 2016, 11:16