Three days of track manager

Three days without a blog post but our work efforts are starting to take shape. The efforts that is, the results are still a bit lacking.
My work for the last three days have mainly been to get the track manager built properly.
The track manager creates the individual segments of the straight pipe which makes up our track, make sure they are created in the right position, that they move backwards towards the camera and finally that they are removed once passed the camera. It also does the same for the obstacles which appear in the track.
The manager contains pointers to the game’s object manager and the game’s camera which it takes as arguments in the class constructor.
It then contains two vectors of game object pointers, when a obstacle is created it is added to only one of the lists but when a piece of the track is created the object is added to both lists. the list of track pieces is used in the manager’s update function to determine where the end of the track is located and from that where new objects should be placed.
The manager contains two floats for keeping track of where an obstacle should be placed when created; the radius of the track which is set to a constant until we have an actual model with a size to put in and the variable rotation which is randomly generated to any number between 0 and 2*Pi. Using these the manager places new obstacles on the insides of the track pipe similarly to how the players are positioned using the following function

x = f_radius*cos(f_rotation);
y = f_radius*sin(f_rotation);

x and y are variables of a Vector3 which describes the obstacles’ positions in the game space. The z variable is simple set to be at the the length of one track node multiplied by the numbers of track nodes which should pit it well outside the outer edge of the camera’s frustum.

The track function works in a similar fashion but a bit simpler as it does not have to keep rotation in mind. A Vector3 is created and set to be equal to the track object at the end of the track list. Then the z value has the length of a single track segment added to it. This function works regardless of where the center of the object is.
If the list of track pieces was empty before adding the new piece it instead sets the coordinates of the segment to be (0, 0, 0).

In addition i added an Enum variable with it’s own get and set functions to the game_object class for easier identification later. right now we only have the PLAYER, OBSTACLE and TRACK objects but this should be helpful especially for collision later. I used the same method in my summer project and had good results.

It’s gonna be a cramped couple of weeks but i hope we’ll be able to finish the game until the end on the 16th. If we’re really lucky we might not have to write our reports until after the hand in. The part and 2 assignments should be finish-able as well but i’d rather have to complete them after the course than this project.