GraphUpdateScene not updating penalties

Hi!

So I’ve got a 2D scene in Unity 5.2. Using Astar 3.7.4, I’m trying to add terrain types to a map. Different terrain types should have different penalties, so I’m using a GraphUpdateScene object to modify the penalties. I followed the documentation about how to set it up, but somehow I’m still doing something wrong - it doesn’t seem to update the graph at all. Here’s a gif of my setup and what I do:

https://www.dropbox.com/s/ae2lqu6hvz8dkir/updatescenegraph_penalties.gif?dl=0

It doesn’t seem to update the penalties of the graph. When I play and move around on the map, my seekers return paths going right through the high-penalty area. I tried with different penalties up to the max of 2147483647
I also have a base penalty of 500 on the whole grid.

I’m out of ideas. Can you tell me what I’m doing wrong? Or something that I could try to do to fix it?

Thanks in advance!
Jinn

PS: seems like I can’t draw new points using 2d colliders, so I have to use a temporary 3d collider to do that. It’s a workaround, but it works.

Hi

Hm. Normally the “Min Bounds Height” field will prevent the bounds from being infinitely thin, but since you are working in 2D, it will not do that (since it clamps the y coordinate, not the z coordinate). Try placing one of your points further back. Check in the 3D view that it actually contains the 3D positions of the nodes.

Thanks for your answer :slight_smile: Great idea. I placed one point further back along the z-axis, and the bounds updated and show a 3d cube now. That did the trick! It’s a bit weird as a workflow, but it works. Thanks!

1 Like

Yeah, I know. For 2D is it a bit weird. Maybe I should introduce a 2D mode for it.

That would be a great feature. I’d definitely be ready for the beta testing :wink: