Limiting the terrain that an actor can walk on

Just create an invisible wall along both sides of your path. And apply physics to it.