- Home /
object move in three lanes
I am developing a game like Temple Run, Epic Knight, Subway Surfer style. My character has been restricted to run in three lanes like in Epic Knight. I am able to set the position of the player on a straight path in the beginning at x=0 for center lane, x=-0.46 for left lane and x=0.46 for right lane. As soon as i take a right or left turn i am unable to position my character to stay in the lanes i have mentioned earlier. When i take a right or left turn my character starts running in x direction instead of z direction.
Any help will be highly appreciated, i m new to 3d world.
Answer by moonstruck · Jun 20, 2013 at 09:53 AM
You can do this in a general way (you need a bit of math here): use 2 lines on the borders of you path and move 2 points simultaneously on these lines. Then you can place the character anywhere between these moving points (simple interpolation: Vector3.Lerp).
Also another way to do it is to track the turns. When the player turns you need to change the axis which is used to switch lanes. For instance, if you go in the positive z direction, then you use the x axis to go right/left. When you turn right you will go in the positive x direction and you need to modify z value to change the lane.
ike subwaysurface..how the charecter lanes in between tracks only...crossing on that how i do....
Thanks For YOur Answer.....
Your answer
![](https://koobas.hobune.stream/wayback/20220613104523im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Swipe Patterns to unlock efects 2 Answers
Android 2D game how to create swipe left/right views 2 Answers
Problem Javascript to C# 3 Answers