Rotate player automatically in an infinite runner to follow a winding road C#
So I have a question here that I do not think has been previously addressed (well at least I can't find anything that can help).
So I am trying to change my level design around at the moment in an infinite runner style game where the player is constantly moving forwards (in a straight line with camera position fixed and centered).
However what I need to achieve is to have the player and camera rotate in parallel with the road automatically when twists and turns are detected so that the player doesn't eventually get stuck running against one of the walls on the side of the road.
So if my road bends to the left several times the player doesn't continue to go forward but instead remains parallel (still facing forward with the road ahead. I have not attempted to code this yet as I just wanted to know the best way to approach this before I do as I can think of several different approaches but I do not know if any of them are the right solution since I have not ever tackled this before or anything similar.
Things worth mentioning: - My level design is spawned as tiles randomly during play so is different each time it is played.
My player can move left and right to avoid obstacles during game, but not forwards or backwards.
Speed gradually increases until it reaches maximum speed.
Not sure if I have explained this well enough but if anybody could provide any pointers at all, that would be really helpful at this stage.
Thanks in advance,
Lee
Answer by aryamansingh2008 · Mar 13, 2020 at 06:40 AM
Did you find a solution? I am stuck on this too!
Your answer
Follow this Question
Related Questions
Mesh wont render although there are no errors! 1 Answer
Spawning a prefab at a specific point in a procedurally generated map 1 Answer
Difference between the various "OverlapCollider" functions? 0 Answers
Procedurally Generated Terrain 1 Answer
InvalidOperationException: Operation is not valid due to the current state of the object 1 Answer