Revolving!

Didn’t make a post last night but we had an interesting lecture about multiplayer networking from the VGAvault form the multiplayer networking engineer who worked on Halo: Reach.
After the lecture we received some links on further reading regarding multiplayer networking which i read that night. During the morning i made little to no progress in the web server so i asked Tommi for a tutor meeting this Wednesday. Hopefully i can get the information i need then.

Because of this i decided to get cracking on the player rotation for the third assignment which is to make a game(we chose the genre racing) in a group in five weeks. In this game the players will race on the inside of a tube by moving to the left and right to move along the sides. My job for this week is to figure out the player movement.
We chose this type of movement because it meant we could declare the players’ positions with a single number; a float which indicates the players’ rotation relative to the center of the track.
So in order to determine a single player’s position using as single number i had two initial ideas.

1. Set the player’s center point to a position above it at the same distance as the radius of the track.
This idea is the most simple, change the player’s global center outside the model and then just change it’s rotation. This would make it rotate around the center point which would change both it’s position and local rotation. The downside to this method was that our collision will probably be based on the player’s center point which would be distorted.

2. Make the player be a child object of an object in the center.
This was my second solution, by making the player the child object of an invisible object at the center of the track the player could be manipulated by rotating the center object or simply rotate the player using the center object at the base. While this didn’t have any specific downside I still wasn’t sure exactly how to implement this.

I went through some other methods with another student involving vectors and momentum similarly to how a satellites stays in orbit but in the end we thought of a way simpler solution.
The player’s global position is determined by three coordinates. (X,Y,Z)
By letting the center of the track be 0,0,0 in the game scene and having the player rotate around it the player’s Z-position will always be 0. Basic trigonometry tells us the X position will be r * cos(a) where r is the radius of the track and a is the angle to the center. Similarly the Y is r * sin(a).
The player’s position at any given time can therefore be written as (r*cos(a), r*sin(a), 0)
A simple equation which relies on a single variable and even allows us to change around the radius of the track.
During the morning i also did some modifications to our SCRUM document, filled in some missing sprint tasks and looked over the planning in general.