Hello,
First of all, thank you for a great asset.
Before I state my question, I want to mention that I did go through the forum and documentation, but I could not find an answer to my question (it happens sometimes with new plugins)
Question 1:
So, my question is as follows. I have a terrain, all flat, and a Seeker going towards the target. During runtime, I have a flattened cube that follows the mouse on the terrain. The entire terrain is walkable and what I am trying to do, is when I click the mouse, I would like the area beneath the cube following the mouse to become unwalkable.
Here is code sample :
`
if (Input.GetMouseButtonDown (1)) {
Debug.Log (“Clicked Right Mouse”);
Bounds bounds = cube.collider.bounds;
Debug.Log ("bounds = "+bounds);
GraphUpdateObject guo = new GraphUpdateObject(bounds);
guo.modifyWalkability = false;
//guo.updateErosion = false;
//guo.updatePhysics = true;
AstarPath.active.UpdateGraphs(guo);
}
public void OnEnable () {
AstarPath.OnGraphsUpdated += RecalculatePath;
}
public void OnDisable () {
AstarPath.OnGraphsUpdated -= RecalculatePath;
}
public void RecalculatePath (AstarPath astar) {
Seeker sk = creep.GetComponent ();
sk.StartPath (creep.transform.position, target.transform.position, OnPathRecalculated);
}
public void OnPathRecalculated (Path p) {
Debug.Log (“Path Recalculated”);
}
`
I get the “bounds” & “Path Recalculated” message, but the path itself does not change. The only way i got it to change/work is by actually raising the terrain during runtime and then triggering the recalculate.
How can I accomplish this without modifying the terrain beforehand ?
What I am trying to achive in game is for the user to model the terrain, scan the terrain(create grid) and then activate(make walkable) or deactivate(make unwalkable) certain tiles.
Question 2 : Also I have another Question. Can I display during runtime different color tiles for the walkable & unwalkable tiles ? I would like the user to see which ones are marked as walkable / unwalkable.
Best regards,