How to limit walkable map?

Hello!

How do I limit walkable or passable terrain in unity? Specifically the curves in cliffs or shoreline.

Possible Solutions I’ve found is
1.) individual collider per tile… (but that also means it would consume more system resource)
2.) transform position every time… (too much to code though)

Is there any other more efficient solution to this?

EDIT:
If you want to limit your character going somewhere, the easiest way is to built a virtual fence out of invisible colliders.

You can either build a fence in the 3d package of your choice and use a MeshCollider on that, or you can use BoxColliders and turn their MeshRenderer off (or delete it). I think the approach usable for you depends mostly on the complexity of your scene.

[For pokemon and such they could use a simple tile-based approach where you could not go from one tile to the next unless specific conditions met (e.g. the tiles being on the same level). Although you could implement such a system in Unity, that would be much more work and not as good as the invisible fences.]


Have a look at the slopeLimit setting of a CharacterController. With this, you can control the maximum ground steepness the character controller can walk up.

thanks felix!

but the situation is if you are in a higher ground you can’t drop down or jump on the lower ground if you comes to an edge and the case if the water level and ground level is quite close

something like pokemon or older tales

ill try to do so…
thanks for the help!

i’ll post again here if I encounter another obstacle :smiley: