I am trying to make a game like Subway Surfers. I am using the Endless Runner tutorial on Unreal’s Youtube as a base. Now, I managed to get my RunCharacter to switch to each of the three lanes successfully, but he always just seems to teleport to the lane with the SetActorRelativeLocation. So I decided to try and throw in a VInterp.
But all VInterp does is make him teleport a little bit in the direction I want him to go. If I set the speed to 100 he just teleports to the correct lane. On 50 he teleports halfway, etc.
Why do you think this is, and how can I fix it? It cannot be because the character is constantly moving forward, because the problem is still there if I make him stand still.
I have tried both VInterp To and VInterp To Constant. The Constant one does not do anything at all.
I see this guy has a similar problem Vinterp not working - Blueprint - Unreal Engine Forums but I don’t quite understand that solution.
Here is a bit of my function for strafing right. I call this function by pressing the D key.
The rest of the function is just to make sure he does not go farther than the farthest lane, which then sets that “Can Strafe Right” bool that you see. That part seems to be working though. I don’t think the problem is there.
Yes youll want to set a sequence and then on the 1st index or whatever start with a branch with boolean condition bVinterp and then on true do your vinterp math stuff. Then for best measure you’ll probably want to do a check after that that says branch(getworldlocation == whereyouwanttogo)) and if true it sets bVinterp to false and if false it sets bVinterp to true
Another way is to use the above check to stop system with branches and checking world location to desired location and then you can add actor offset in whichever axis you want instead of the vinterp this is the “classic” way to do it.
You could even create a function that moves the player to lane 1,2,3,4, whatever from the current lane based on where they currently are. It could be as simple as a function with input “bLane1, blane2, blane3, speed” and be called on the tick when you want to move to a new lane. Of course this function would have to know which lane you are in so I suggest finding a way to set a int variable at all times on tick for whichever lane you are in.
Lots of ways to do it
Hope this helps Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.
Do I do all of this in the Event Graph or in the Function? I tried adding a Timeline to the function, but seems like I cannot do that. I have an Event tick that makes my character move forward forever (as I said, I followed the Unreal Endless Runner tutorial, so my character is mostly set up exactly as in the tutorial), but if I plug my function into that, my character immediately strafes (Though it is actually smooth now), and he strafes farther than he must. So plugging the function into a Tick instead of the D key makes my CanStrafe bool not work. Sorry if I seem a bit uneducated. It is mostly because I am XD.
My tick event is currently making my character run forward. If I plug my function after my forward movement function, my character immediately strafes, regardless of what I set the “CanStrafe” bool.
No I’m not using one. Should I plug it in before the function? Because I cannot put it inside the function. Or should I ditch the function altogether and make a macro?