How to move player like cube surfers game or sky roller?

Hello! I am trying to make a gam but have troubles about implementing movement of the character. I want to make a game similar to cube surfers and sky roller(more like cube surfer). So, I want to make player follow a path which is curved prefabs are included and at the same time I want to move the player horizontally by sliding on screen. Exactly like cube surfers. Here is the video how it looks

.

playerRB.MovePosition(playerRB.position += transform.forward * moveSpeed * Time.fixedDeltaTime);
           

            if (Input.GetMouseButton(0) && destructWallBonusBool == false)
            {
                // playerRB.velocity = Vector3.zero;
                NewX = Camera.main.ScreenToViewportPoint (Input.mousePosition).x;
                xMotion = (LastX - NewX) * -NavigationMultiplier / Screen.width;

                rbPosition = playerRB.position;
                rbPosition.x = Mathf.Clamp(playerRB.position.x + xMotion,-1.1f,1.1f);
                playerRB.position = rbPosition;
            }

            LastX = Camera.main.ScreenToViewportPoint(Input.mousePosition).x;

I was using this code to move my character. It works perfectly when player is moving only on z axis (forward) I can’t make it follow the curved paths perfectly. I have tried to insert triggers at the start of the prefabs and I was detecting whether player has entered to left or right turning tiles according to this I was rotating the player with iTween. However, when I enter to curve from inside or with different speed (when the player activates power up for instance) it doesn’t turn correctly. I have also tried to use pathfinder assets and there were some problems too. First of them I am generating levels randomly so I can’t tell the pathfinder which objects it should follow. When I insert waypoints inside prefabs I cant use them because their position is relative to parent so waypoints are not appropriate. Also I cant move my player horizontally when it turns. Lets say player goes on +z axis I can move player horizontally(-x +x with the code that I have posted above) but when player turns 90 degrees right then it starts to move in +x and moving horizontally will be between -z and +z axis however the code above is only for x axis. I thought to create booleans and change the .x variables to .z according to the move direction but maybe there is a better way to do it. I have no idea how I can do this right now. Any help is so much appreciated. Thanks!

There are actually tutorials on how to recreate this game in Unity. Did you work through any of those?

Yes, the tutorial series of 3d endless runner is not what I’m looking for. There are no curves there. I have tried to move the player with raycasts etc. too but nothing worked. Have no idea right now.
Thanks for response!

Have you tried any one of the free bezier spline or curve or tween packages on the appstore?

Yes, I have tried itween and bezier creator asset they were nice for following the path but I can’t move my player horizontally like on these games than. Player sticks to a route and follows that. Another problem is for example my code works for x axis and when the player rotates to left then its horizontal axis changes to z axis to the code is not working there. I need to be able to move the character horizontally according to the face where player looks.

Use another GameObject as its parent:

BasePlayerGameObject
    GameObjectThatLocallyGoesLeftRight
        GameObjectThatFollowsWhateverSplineYouWant
             VisiblePortionsOfCharacter

Break the problem apart.

Thanks! https://assetstore.unity.com/packages/tools/utilities/dreamteck-splines-61926 I have tried this asset here. I have created a path and I’m changing the x offset of the path to give the look that player is moving horizontally. It’s working perfectly now! Thank you for help.

Hi, so did the asset worked to fix the rotation? Or could you please explain to me in more detail how did you solve your problem? Like did you made the floor rotate instead?