yeah, i got it… totally my mistake: in the “at end” function i used the “player location” variable instead of the “last point” variable, it works AB-SO-LUTELY perfect now
FAB
( and a bit more text otherwise it won’t let me post )
Sorry to bother you once more (or more than once depending on how this goes ) but how would i tackle the whole switching lanes thing and more specifically, the switching lanes after a turn (i would say a turn that is 45 degrees or more) has taken place? Once you turn a corner, you are technically no longer switching lanes on the Y axis but on the X axis, i’ve tried many things but I really have no clue of what i’m doing
You’ve probably noticed that this system works for corners already, right? It’s because the X and Y stuff is local to the tile. We’re not talking about the world.
Two lanes works in exactly the same way, but you have two splines, and you have to decide which one to ‘suck’ the player to, depending on which lanes they’re in.
right, that makes sense. You’d just add more splines to the tiles and go from there, right? But since the player movement isn’t really “snapping”, the player just casually “jogs” to the next lane instead of “snapping” to the next lane, the way it’s typically done in an endless runner game. So that’s totally fine but then the question would be, how can i make my character “suck” or “snap” to the next lane? I’m at a total loss here.
That code ( up there ), it already does it. Using the ‘nearest location on spline’ node.
All you have to do, is change the spline reference to your other spline.
so the event tick node is on the center spline and D would be the right spline
No quite. It’s the exact code from above. All you have to do is set the spline ref to spline1 or spline2. The code does the rest.
Sorry, it’s late, I’m not being very clear.
You already have the code to follow one spline, but instead of putting the left or right spline reference in there, you put another spline variable in, ‘spline to follow’.
When you want to change lanes, all you have to do is change the variable from left to right spline.
Right, okay. You mention putting another spline variable in ‘spline to follow’… you lost me there. I’m so sorry, it’s probably a lot easier than I think it is
I will come back to you later today ( sorry, very busy )…
My original idea was this
As you can see, very easy to change splines.
The problem is, when a new tile spawns, it doesn’t know about this.
So you need a separate actor to store the current spline in. ( more in a mo ).
So we have a ‘spline chooser’ blueprint, you drop it in the level, and the only code it has is
Then, the tiles do this to setup the variable
On begin play, the tile finds the chooser, and figures out which spline to use. When you swap lanes, the tile tells the chooser, and the next tile knows about this when it’s spawned.
boom.
well, not sure what I’m doing wrong here but this does not work either… (so it’s safe to assume i did something wrong )
got the “Spline Chooser” Blueprint in the level as you can see:
Got the code the exact same as you can see here:
and here as well:
in the video below you can see that the player get’s stuck on the center spline (it doesn’t matter in this case, if i replace or turn that spline off, it’ll just get stuck on the left or right spline, depending on which spline i set it to) and as you can see as well, the player get’s stuck for about a second before it’s starts moving again and is unable to move left or right.
i have no idea what i did wrong but i cant imagine it being THIS hard…
I did not, as i didnt know (i shouldve known ) but i changed it and now it defaults to the right spline and the exact same thing happens as you can see in the video above.
You have 3 splines. If you want to do it with 3 splines, you have to do the same thing I have done here, but with 3, of course.
You’re moving the goalposts…
Or take out the code for centering on the middle spline for testing.