- Home /
Keep the player on a path?
I have a path drawn using the Terrain Editor, but I'm stuck with one problem. I need the player to be bound to the path, unable to go outside of it. I still need them to be able to walk around freely within the path, but not able to leave it. I started placing box colliders along either sides of the path, rotating them where the path curved, but that seemed like an extremely tedious and unnecessary way of doing it, as my path is very very long, and winds back and forth all over the place. Is there an easier way? I have found a couple other questions like this, but people only suggested iTween. I looked into iTween, but it doesn't do what I need it to. iTween seems to only Lerp objects between points on a very precise path. This is not what I need. I need the player to be able to move around freely on the winding path, but not be able to get off of it. I keep repeating this because people don't seem to understand this question, and keep suggesting iTween. Is this even possible? If so, how would I go about doing it?
Why don't you use planes turned side ways with the renderer turned off?
You can scale them quite easily and it's easy on performance. The planes will have plane colliders on them when you create them.
That's pretty much what I started doing with the box colliders, but honestly, that seems like a very tedious method. I was wondering if there was a better way.