This week I focused on making the movement limited around our track, so the player doesn’t wander off. This was quite easily done with a radius, and checking the distance between the player and the spline. Right now, it is a bit jittery at the edge, but I’m hoping I can resolve that in the production phase.
Here’s a gif of the constraints:
I also did some work with the camera. I found out that the camera won’t need a script at all. We just have an object following the middle of the spline, and we make the camera child of that object. The object will always follow the orientation of the spline too. Because of this, if we put that camera tracker in front of the player, the camera will rotate with turns, and the player can see the next potential obstacle.
This is what it looks from the side, with gizmos on:
Finally, I also did the items. This was a bit of a challenge, as I wanted to have orbs in clusters, whilst still following the orientation of the spline. What I ended up doing, is rotating the first orb with the spline, and using that forward vector to place the next orbs. The first orb is placed at a random location within the playable radius. There is also a UI element which keeps track of your score in the top left.