Making a custom bridge asset walkable

I got a bridge from the asset store that comes without any colliders. Upon adding to the scene I realized my character will not walk over this bridge. I went back and watched the lecture by Ben titled “Refine your mesh” in section and realized his bridge has a mesh collider. I have added a mesh collider here as you can see from the screen, but how can I proceed to make this object/asset walkable?

Even baking the scene is a non-starter before one gets the mesh sorted out properly on this object.

How does one proceed from this point?

Hi Vladimir,

Following on from our private message;

I’ve just grabbed a free bridge asset from the store to test something, and initially no NavMesh was created over the bridge. In the first instance this was because I hadn’t set the bridge GameObject to be Static.

In the second instance, this is because of the Min Region Area setting in the Navigation window;

image

It’s requiring 2 units, I made this bridge narrower initially, and as such, it didn’t create the NavMesh over the bridge. You could adjust this value, however you need to consider whether the models that you plan to have move over the bridge will then fit. An alternative is to make the bridge wider, allowing for the above setting, or, to tweak both until you are happy.

Below is an example in a simple scene. Two cubes, scaled out to make a ground, an the free bridge asset, as you can see, the NavMesh has now been created over most of the bridge. If I were to move the ground on the other side closer, or make the bridge longer, or create some off-mesh-links.

image

Also, select the bridge GameObject and then look at the Object panel in the Navigation window, make sure the Navigation Area is set to _Walkable.

image

Hope the above helps :slight_smile:

1 Like

Ok, so I downloaded your bridge asset, it’s huge! I had to scale it by a factor 1000 to fit it in to my example scene. I set it to Static and then rebaked the nav mesh;

image

On the other side of the bridge there is a small area that didn’t quite get baked, nothing major, but you’ll probably need to tweak its scale/position and so on to make it work cleanly.

Here’s another technique you can use if you run into significant problems with models like this, note I have thrown this together very quickly and it could be vastly improved. Basically, I’ve created three cubes, angled two and then moved them together to form the shape of the bridge, just under the area that the character would walk over;

What we can do now, is set those all to Static and build the NavMesh;

image

Note, I have just disable the actual bridge in this view just so you can see the NavMesh.

Next, we select the cubes that are making our NavMesh bridge, and disabled their Mesh Render component;

image

Now they do not appear in the scene;

image

Finally, we enable the real bridge model again;

image

Now, if we were to let a character walk over this at the moment you’d have some issues with their feet going through the bridge a bit and so on, as I said, I threw this together very quickly just as an example. You could refine this much more though so that the feet weren’t an issue and this enables you to create the NavMesh data for the areas which might otherwise be tricky.

Hope this helps :slight_smile:

Thanks Rob, that was very helpful. I have plenty to work with to move forward on this. Will post my fix in the next day or two.

1 Like

Thanks Rob, that was very helpful

You’re very welcome Vladimir :slight_smile:

Will post my fix in the next day or two.

I’m learning towards the Static setting on the bridge myself :slight_smile:


Updated Sat Sep 29 2018 23:23

Finally had change to open your project and test the theory. The bridge wasn’t set to Static, as soon as I did this and then cleared and rebaked the NavMesh, it was ok.

image

image

As you can see in the screenshots, there are a couple of areas of issue, a bit actually on the bridge and then the approach to the bridge, especially on one side. The approaches should be resolvable by some minor tweaks to the terrain. The issue actually on the bridge, I managed to clear up by tweaking the scale on the X axis fractionally.

Privacy & Terms