Have a character move right and left after turning a corner with a lane system?

Hello!

I’m still fairly new to blueprint and am having trouble with movement within a lane system in my endless runner prototype. So right now I have it so that the character either moves -/+ # of units in the Y-axis to switch lanes. However, this no longer works after I make a corner turn as he is facing a new direction.

Video of the lane system being demonstrated before and after making a turn: environMENTAL - Game Dev #01 - YouTube

How can I make it so that the direction is updated when he turns a corner so he is able to still move left and right? I would assume I would need to have it so he can move in only his Y-axis and not the world’s Y-axis?

This is what the blueprint setup looks like for the movement right now and it is the same for the Move Right blueprint except + in the Y-axis.

Thanks!

You should move left/right in your pawn local space, not in world space.

Instead of just adding {0, 200, 0} to your location, use your pawn right vector multiplied by +/-200 and everything should works fine :smiley:

That worked perfectly and was so simple! I knew there was some other vector orr something I had to get from the actor! I thought it was forward vector but I should have been hovering over them as that is X and right vector is for Y!

Thanks a lot for the response!

I had another question though in how I could contain this so you can only move over a certain amount of times? I want there to be only 4 lanes and right now you can continue moving so you move outside of the walls. I would think there is a way to limit the movement so you can only move so many times each way maybe?

Thanks in advance!

hey… how can I create this Lanes System? From the begining

Here ya go!

It might be old, but Blueprints in UE4 tend work regardless of version, so it should at least get you started. :smiley:

how did you got the lane system working

The Best Thing Is Use Unreal Spline System , This Will Completely Fix The Issue;