Here is the deal…, I am trying to make kind of a lane game (almost like subway surfers style) with a flying ship as the player, but i don’t want to limit it to the lod boaring 3 lanes, instead… i want to limit it to a straight line across the screen, then as the ship gains speed and the overall game gets faster the line slowly transforms into an arch (sorry for bad spelling if thats the case) somthing that looks like this:
obviously this is just an idea at this stage cuz i have literally just thought of it and i haven’t done anything like this before so i really dont know how to go about this one.
It’s worth mentioning that this is a mobile game, and the controls aren’t going to be swiping, instead by tapping on both sides of the screen.
This would be a good use case for bezier curves!
You can set the position of the player along the bezier curve, where the t value is the player position, as a value from 0 to 1, where 0 is on the far left, and 1 is on the far right. Then you can reposition the tangent points of the curve as you gain speed to change the shape of it, so, A and D would move up as you go faster
If you want some resources on how they work and how to code them, I wrote about them a while back here!
Another alternative is to use parabolas, though it’s a bit more mathematical and less visual!
you can set the player y position with ax², where x is the player x position (assuming 0 is the center in your image) where you change a based on how fast you’re going. 0 would be flat, and 0.5 or so would make a soft curve, and 4 would make a sharp curve! You can try it out here if you want to experiment and see how it works!
Sounds very simple but could work very well:
You define a heightfactor for the sides
and then multiply the current speed with the factor,
so it basicly is on the lane but with increasing speed it gets higher on the y-axis.
Then clamp the maxHeight with Mathf.Clamp(value, min, max) and you got what you want.
Maybe rotate the ship based on the x postion and done.