Air Race over UCSD
We're currently still tweaking this writeup but feel free to get started the changes will be minor. We're finalizing it by Feb 9.
This project can be done in teams of two, and you have two weeks to do it.
In this project we're going to use the Leap Motion for hand gesture input, attached to the Oculus Rift's front. Leap Motion mounting brackets have been installed on your Oculus Rifts, and Leaps along with extension cords should be in your lockers as well. You are not allowed to use the Oculus Touch controllers, keyboard, mouse, or any other input devices. The Leap Motion drivers should have been installed on all computers. Let us know if you're missing any parts or drivers.
If you are not familiar with air races, you might find this video entertaining and informative.
Our version of the air race actually resembles the rather new category of drone races more. Here is a great video illustrating how it works. Here is another hopefully inspirational video for this project.
As an example for what we are looking for, here's Mitchell Topete's Air Race project from Winter 2017.
Leap Motion Access From Unity
We will cover this in discussion on Feb 11.
1. Race Track (30 Points)
This UCSD campus model provides the environment for the race track. The unit size is one inch, so you have to scale the model to match Unity's unit size, in order for the campus to show up life sized. Load it into your application and turn the buildings and the ground plane into colliders that cannot be traversed.
The race track is a set of check points the player has to go to in a specific order in order to win.
During grading, we are going to bring a competition file with us on a thumbdrive, which you will have to load in to your application on the spot. The competition file will be an ASCII file in the XYZ file format, listing the locations of your check points. The coordinate system will be the same as that of the campus model. An XYZ file does not have a header, it only consists of a list of point locations in 3D, in the format X Y Z<return>X Y Z<return> and so on. An example for an XYZ file defining two points is this:
-200.0378 100.1279 10.0475 -202.0447 103.1288 10.0905
The coordinates are separated by white space or a tab character, the points are separated by a line break. On each line are three floating point numbers. The first three are the x, y and z coordinates of the first point. The next three numbers are the x, y and z coordinates of the second check point, and so on. There could be hundreds of points in the file. In this project you can assume that the competition file will not have more than 100 check points.
Here is what you need to do:
- Load campus model and display at correct scale. (5 points)
- Write a parser for XYZ files. It should be a simple for loop in which you read each line of the file. In C you would use the fscanf command for this. Your parser does not need to do any error handling - you can assume that you will get a proper XYZ file. You do need to recognize when there are no more points in the file (i.e., check for End of File) (10 points)
- Draw the check points using a method of your choice. You can assume that all check points will be floating above the campus model and will not intersect with any buildings. For instance, you can draw the check points as translucent spheres. The goal is that the visualization should allow the player to move from one check point to the next as fast as possible without missing any. A check point is reached once the aircraft's origin gets within a fixed radius of 30 feet around the check point. (15 points)
Here is a sample race track, whose points are relative to the campus model. And here is a picture of where the checkpoints should be located. For further testing, here is a previous year's competition file. The check points should be in these locations.
- -2 if campus model is loaded at the wrong scale
- -5 if any check points are in the wrong locations
2. Flight Controls (25 Points)
You need to implement a way to control the aircraft which uses only the data from the Leap Motion. You are only allowed to use the tracking data from the Rift HMD to transform the Leap's data into room coordinates.
The aircraft needs to fly continuously and can't instantaneously 'teleport' itself anywhere at any time. You do not need to worry about momentum, but can assume the aircraft has no mass that needs to be accelerated or decelerated (i.e., the aircraft can accelerate to any speed at any time instantaneously or stop instantaneously).
Any sort of auto pilot is not allowed - your aircraft cannot autonomously fly or automatically respond to the world around it. For example, it cannot automatically avoid buildings or the ground, and it can't automatically steer towards check points.
- -10 if airplane controls aren't exclusively done with data from the Leap Motion
- -10 if airplane doesn't fly continuously (stopping is allowed) or an autopilot is used
- -10 if the user is unable to finish the race within less than 5 minutes
3. Wayfinding (20 Points)
The check points can be quite far from one another, so it will be important for the pilot to know where the next check point is. Come up with at least two different visual ways of helping the player to know where to go next. For instance, you could have an arrow pointing to the next checkpoint along with an indicator for how far it is. At a minimum there has to be some indication of the direction of the next checkpoint. (10 points for each wayfinding aid)
Note that there are four coordinate systems in which you can reasonably display the wayfinding aids:
- world coordinates (which the campus is in)
- aircraft coordinates
- head coordinates (the Oculus Rift's coordinate system)
- hand coordinates (determined by the Leap Motion)
Each of the two visual wayfinding aids has to be displayed in a different coordinate system.
- -5 if a wayfinding aid has a visual but is not functional
- -5 points if both wayfinding aids are in the same coordinate system
4. Gameplay (25 Points)
The player's aircraft should start at the first check point, with zero pitch or roll (level with the ground). It can be facing in the direction of the second check point (heading). (3 points)
There should be a countdown timer. Before the countdown ends the aircraft can't move. Once the countdown is done, a stopwatch starts running and is visible to the player. (3 points)
You should use a first person view: the aircraft itself is not visible to the player. See the extra credit option for an alternate option. (3 points)
The player takes control of the aircraft and tries to fly to the next checkpoint as fast as possible. Once that checkpoint is reached, there needs to be some sort of visual notification that the checkpoint has indeed been reached. Once the last checkpoint has been reached, the race is over and the time is halted and needs to remain visible. A checkpoint is considered reached when the airplane's collider collides with the checkpoint. The aircraft's collider cannot be wider than 1 foot in any dimension. Checkpoints cannot be skipped, each checkpoint has to be reached in the correct order to finish the game. (8 points)
If the aircraft collides with the ground or a building it should be moved back to the last successfully cleared checkpoint, and another countdown should be initiated before the player can continue. The time between collision and the player regaining control of the aircraft has to be no less than 3 seconds. The lap timer should not stop when a crash happens. (8 points)
Grading will include that you fly your aircraft along all the checkpoints and we record your time. Who is going to have the fastest lap time in class, and what flight control method will it be achieved with? We'll determine the winners of the competition once we're done grading everyone. Then the top three teams are going to have to race one more time with all graders watching. The result of these final races determines the winner.
- -4 if reaching the checkpoints in order is not enforced
- If the penalty for a crash is less than 3 seconds the team gets disqualified from the competition.
5. Extra Credit (up to 13 Points)
- Motion sickness mitigation: implement two ways to see parts of or the whole airplane. Use Unity assets or design your own with a 3D modeling tool such as Sketchup. Add an interaction method to switch between the three viewing modes (view from pilot without visuals, from pilot with cockpit, from behind airplane) during flight, using only Leap and/or Rift), and find out which modes create more or less motion sickness for yourself or others.
- Display the cockpit the pilot sits in and allow the user to look around it. (2 points)
- Display the airplane from a 3rd person perspective behind the airplane. The camera doesn't need to be in a fixed spot behind the airplane, but the airplane must always be visible in this view. (2 points)
- Audio: add sound effects to the experience. Use a motor sound with increasing pitch for faster speeds, a countdown sound effect when the race starts, an effect when checkpoints are reached, an effect when the plane crashes, and an effect when the finish line is reached. Feel free to add additional sound effects. (2 points)
- Spatialized audio as an alternate wayfinding method: use the Oculus spatialized audio library (built into Unity) to make the next waypoint emit an audio signal coming from the waypoint. In this mode, you have to disable all visual wayfinding aids (except the display of the waypoints themselves). (4 points)
- The top three best times of the competition get extra credit points: 3 for 1st place, 2 for 2nd place, 1 for 3rd place. (up to 3 points) Participation in the competition requires full credit for parts 1, 2 and 4 of this homework project.