Okay so I am trying to get the graphMask to operate properly, but I seem to be running into some issues
Essentially I have 3 graphs in this order:
- Recast Graph for ground units
- Grid Graph for floating units
- Grid Graph for air units
Each of these units only moves in the xz direction
I am using the AIPath.cs script and made the following adjustment to the Init function:
void Init () {
if (startHasRun) {
if(enemyType.Equals(EnemyType.Ground))
{
graphMask = 1;
}
else if (enemyType.Equals(EnemyType.Floating))
{
graphMask = 2;
}
else if (enemyType.Equals(EnemyType.Air))
{
graphMask = 3;
}
lastRepath = float.NegativeInfinity;
StartCoroutine(RepeatTrySearchPath());
}
}
public virtual void SearchPath () {
if (target == null) throw new System.InvalidOperationException("Target is null");
lastRepath = Time.time;
// This is where we should search to
Vector3 targetPosition = target.position;
canSearchAgain = false;
// Alternative way of requesting the path
//ABPath p = ABPath.Construct(GetFeetPosition(), targetPosition, null);
//seeker.StartPath(p);
// We should search from the current position
seeker.StartPath(GetFeetPosition(), targetPosition, null, graphMask);
}
It seems like it works just fine for the first two, but I am getting some wonky behavior from the third. The “wonky behavior” being that the air unit seems to be using the second graph instead of the third. Anybody see anything jumping out that’s incorrect regarding the setup?
Just started using this asset today so I’m still learning the ins and outs