A simple way to make a bridge (walkable)

Hello everyone.
Here is my way to build a bridge for your scene.
Select few trunks you love.
rescale them and place them where you want.
For me something like that:

Yes it’s a big one, probably Sequoia :slight_smile:
Put everything in an empty game object called … bridge ? :slight_smile: for example.
In the Parent Game object add an cube and resize it to simulate a kind of floor like this for me:

Bake your NavMeshSurface.

And hide the cube.
Let’s traval the world !!!
:stuck_out_tongue:

You have now your own bridge walkable easily.

Don’t forget to display again your cube when you will recalculate your NavMeshSurface later.
++
François

3 Likes

Great work, it’s often a good idea to replace the default colliders of a more complex shape with a simpler shape, such as a ramp or in your case a rectangle. This can help with performance and also prevent any unexpected physics interactions

Perhaps the shape should be positioned so that the player can enter it from more than just the left side? Apart from that, everything is fine.

void Start() {
     this.gameObject.setActive(false);
}

If you do something like this, on start of the scene the object will disappear. This is helpful, as if you disable it in the editor and go to rebake the navmesh, you may forget to reenable the object resulting in no navmesh being baked for the bridge.

2 Likes

You could also have a gameobject called something like InvisEnvironment and have a script with an array of game objects to remove at the start of the scene.

[SerializeField]
GameObject objs;

void Start() {
     foreach (GameObject obj in objs) {
          this.gameObject.setActive(false);
     }
}

In the inspector just increase the value for the objs array and drag and drop anything you want to disappear at the start of the scene. You could also run these calls on Awake instead of Start if you want.

Nicely done!

Hello everyone.
Thank you very much for your feedbacks.
I was in short holidays this week end without computer so I read your replies only now.
It’s a very good idea to disable this kind of object with a script.
It will prevent some forget during a baking of the navmesh agent :slight_smile:
Thanks a lot.
Have a nice day.
François

1 Like

Privacy & Terms