I'm creating a side scrolling endless runner game that procedurally generates platforms ahead of the camera.
I'm quite new to coding.
I have the new pieces of road spawning when my player runs into a trigger, but am unsure how to set the position of this newly spawned piece to be right next to the current piece of road.
I've so far managed to trigger the spawning of the next piece of road, but it spawns directly on top of the trigger because I haven't given it additional position information.
My aim is to calculate the edge of the current piece of road and spawn the next piece directly next to it.
I'm also conscious that I will want to have different sized pieces of road to draw from i.e. I can't just input a number as the distance the spawn will be from the trigger will change depending on the piece.
Any help calculating where the edge of my current piece is, and how to position the new piece directly next to it would be greatly appreciated.
Cheers.