- Home /
Character moves along pre-defined path / curve
I'm making a yet-another-endless-run game. I know how to make my character ( which is now a cube with Rigid Body component attached ) moves along axis and changes its moving direction by Arrow keys.
However, moving in straight line is boring. Therefore I would like to add some curves to the road, such as this:
But how do I make my characters to follow the path? I search in Google, Unity Answers, Unity Asset Store & the forum, and found these:
but seems all of these are pathfinding algorithms. I just want the user moves in a certain curve instead of straight line. Did I miss out other code sample or tutorial ?
Answer by zee_ola05 · Feb 04, 2014 at 12:05 PM
Create a container object. Add your Runner in this container object. Make container object follow your curved path (itween or whatever). You can move Runner horizontally using a script and it will still look like he's running because the container object is following the path.
Does it make sense? Clarify in comments. :)
seems I have to spend some time on iTween. Get back to you if I encounter further problems. Thanks.
Does this solve your problem? If it does, please accept as answer. Thanks! :)
Yes, but I have further question on combining iTween with Physics acceleration. Will ask in separate question
But then will it run along the path? Will it bend towards the curved or circular track or path?