Switch spline to follow on player input in EndlessRunner game

I have 3 splines on my Tile that keeps getting generated as my player goes from one to another. and I have player follow middle. I want that on player input they can swap what spline they want to follow. For now if i try to swap it snaps back to middle one.

I got alot of help from this one Endless runner. Spline paths - #63 by R3DMyst89 But still I cant figure it out completely.

I set the last spline point here .

If player pverlaps actor this var is set.

code to follow spline .


It gets the variable that is currently true from splinechooser that.

This is in my SplineChooser . It gets currentLane from my player.

I assume what’s happening, is the player is choosing to use another lane, but that decision is getting reset when they change tiles?

I think so . It worked really clumsily and broken when I threw swap lane function into tiles tick event.

Right, that would not be the place. But once you’ve chosen the left lane ( for instance ), the variable should stay the same, even when swapping tiles…

Atm when I gave it input to change lane it moved to new lane couple of tiles later and it stayed there. but after couple of turns (90 degree corner) later it just goes off the spline cause of weird rotation, Maybe I should trash the splines and figure out how to just center the mesh to middle lane after the corners

1 Like