I have run into a similar problem. I am using the Pro version and have set up a Flood script. It’s completely ignoring the penalties and traversability. I dropped my bots into the “PenaltiesExample” and they just walk across it as if it isn’t there. I feel like I need to incorporate something into the script but I can’t find an example of what I need to do.
In Start I set up the pathing:
_floodPath = FloodPath.Construct(_target.transform.position, null);
AstarPath.StartPath(_floodPath);
_floodPath.BlockUntilCalculated();
FloodPathTracer fpathTrace = FloodPathTracer.Construct(seeker.transform.position, _floodPath, null);
seeker.StartPath(fpathTrace, OnPathComplete);
I have a function called RecalculatePath that essentially does the same thing. This will be for a TD style game and so I need to have the AI react when a new tower is placed. That line is commented out now since I am simply testing the AI getting from the start to the target, which currently is stationary.
My Update function is:
if (Time.time > lastRepath + repathRate && seeker.IsDone())
{
lastRepath = Time.time;
//RecalculatePath();
}
if (path == null)
{
return;
}
reachedEndOfPath = false;
float distanceToWaypoint;
while (true)
{
distanceToWaypoint = Vector3.Distance(transform.position, path.vectorPath[currentWaypoint]);
if (distanceToWaypoint < nextWaypointDistance)
{
if (currentWaypoint + 1 < path.vectorPath.Count)
{
currentWaypoint++;
}
else
{
reachedEndOfPath = true;
break;
}
}
else
{
break;
}
}
var speedFactor = reachedEndOfPath ? Mathf.Sqrt(distanceToWaypoint / nextWaypointDistance) : 1f;
Vector3 dir = (path.vectorPath[currentWaypoint] - transform.position).normalized;
Vector3 velocity = dir * speed * speedFactor;
controller.SimpleMove(velocity);
I have 2 AIs and they match the penalties set up in the example: a penalty of 300 for one of them and non-traversible for the other. It makes no difference. I am sure I am missing incorporating the tags, I just need to figure out how.
metaldonut, I think you and I may be in a similar boat here. Not sure if this helps you. I’m still trying to figure it out.