Big Game Project – Post 2

Another week has passed, and here comes a summary of what I’ve been up to this past week.

The tasks I took in our weekly SCRUM sprint was:
Vehicle rotation & Gravity towards the track.
Simple AI racers if the level generation finishes.
Multiplayer Interactions.

The first one you can read more about in last weeks post. (here)
I only altered the gravity to now apply forces to the rigidbody of the object instead of forcing it to move using its transform.position which causes bugs and glitches in the collisions/physics (vehicle moving right through the track for example), and the rotation was hardly touched at all.

The simple AI was not worked on since the level generation is not yet complete, I did however set up a waypoint system that will both be used by the AI and as a way to track each racers position in the race. Position is done through calculating which racer is closest to the next waypoint using Vector3.Distance.
The waypoints is basically a script on a dummy object that adds three buttons to the ui: Add waypoint to (0,0,0), Add waypoint to Last and Add waypoint to Starting area Object.
The three buttons are somewhat self explanatory, the add to last finds the last waypoint added and adds another waypoint in the same position. These three are used to make it simpler to position waypoints in the world since just moving them from the last waypoints location is easier than manouvering them from the 0,0,0 of the world every time you want to add a waypoint.

Multiplayer interactions was touched upon somewhat, I made the game split the screen depending on the amount of controllers are connected at the start of the game.
It then created playerobjects from a prefab and changes their viewport to fit half/a quarter of the screen.
The prefabs then execute a script that changes layer on an indicator that every other player can see, so that the players view is as clear as possible.
The indicator is there to show the other players where they are, a green animated arrow above their vehicles.

 

This is an image of the track with the waypoints placed randomly, they will be generated through splines when the level generation is finished but for now this is fine