CSE 566 Virtual Reality

Spring 2023

Prof. Arie Kaufman

Assignment 3: Advanced VR

Credit: 25% of final grade

Due date: Monday, April 3, 2023, 11:59 p.m. (Stony Brook Time)

 

Now that you have learned how to design a virtual reality scene with interactions, let's build something a bit more challenging and fun. In this assignment, you will design and play mini-golf!

 

For this assignment, a group of three students will be provided with an Oculus Quest VR system to share, which includes a headset and a pair of controllers. Each student should login to the Quest with their own credentials. Although you are sharing the VR device, this is NOT a group project. You are each expected to work separately and submit your own projects.

 

Overview

For this assignment, you will be utilizing the Stony Brook campus scenes you developed in Assignment 1 to create a “build-and-play mini-golf course”, where the player can switch between the following three modes:

-       Navigation Mode: The user can traverse the scene easily.

-       Build Mode: Build a mini-golf course by placing course components on the ground.

-       Play Mode: Play mini-golf on the course that you constructed using your Build Mode.

The user should start in Navigation Mode, spawning somewhere on the campus map.

 

Since for this assignment, you are being provided with HMDs that perform tracking, you can now physically walk in your designed virtual 3D scene! Therefore, in the Navigation and Build Mode, the user should traverse short distances in the scene by walking (physically moving with the HMD on), and larger distances in the scene using teleportation areas.

 

The user can travel around the campus map, constructing individual holes (A golf course consists of a series of holes) as part of a larger mini-golf course. Each hole is made up of a series of golf course tiles that the user can place in a grid-like fashion on your campus map.

 

As the user builds the mini-golf course (see section below for details), they should be able to play individual holes that they have designed. To play a hole, the user simply teleports onto a starting tile to enter Play Mode.

 

Once in Play Mode, a golf ball spawns, and a golf club is attached to one of their hands. Using the Quest controller, they can hit the ball along the course. If the ball lands outside the course (or falls off the map), it restarts back to the last best position. If it stops within the course, the user is automatically positioned close to it so they can hit it again. The goal is to hit it into the virtual hole (called the cup) at the end of the course within three shots, at which point the golf club is removed and the user re-enters into Navigation Mode.

 

 

Quest Controller Buttons

We will be discussing the assignment using the terms for the buttons and inputs available on the Quest controller, which are defined here. On the left controller, there are also X and Y buttons; on the right, A and B buttons.

 

Switching Between Modes

Users start out in Navigation Mode. To enter Build Mode for a new hole, they press the Y button. To leave Build Mode, they press the Y button again.

 

To enter Play Mode, the user teleports onto the starting tile of a hole, which starts Play Mode and disables teleportation. If the user wishes to leave Play Mode, they simply press the Y button; the golf club is removed, teleportation is re-enabled, and the user is automatically returned to the last off-course/off-tile position before they entered Play Mode. In such a case, progress made during the hole is lost, and if the user tries to play it again, they start from the beginning.

 

A virtual 3D model for the controllers should be visible during Navigation Mode and Build Mode. You do not need to use a specific model for the controllers, but you should make sure that there is some 3D model serving as the representation of the user’s hands.

 

Navigation Mode

Users can navigate short distances by walking in the physical space with the head-mounted display on. However, it would be difficult for most users and their physical space to traverse the entire terrain in such a way, which is why we’ll be implementing a Teleportation area.

Figure 1. An example of interacting with a Teleportation area.

(Source: https://www.circuitstream.com/blog/vr-locomotion)

In Navigation Mode (and Build Mode), the right controller is used to teleport anywhere that’s covered by a teleportation area. The right controller should emit a curved ray that, when intersecting with the plane of the Teleportation area, shows a circular target that indicates where the user will teleport to. The depth of the ray (how far the target appears from the player) can be increased by pressing the right thumbstick Up, and decreased by pressing it down, from a minimum of 1m to a maximum of 10m. Clicking the right controller grip will teleport the user to that location. During Play Mode, this functionality is disabled. An example image of a Teleportation area is shown in Figure 1.

 

Build Mode

When the user wants to design a new hole, they can enter Build Mode by pressing the Y button. In Build Mode, the left controller is used to choose objects and place them on the map.

 

When entering Build Mode, the user begins construction on a single hole by placing “snappable” tiles. Each hole can contain as many snappable tiles as the user wants, but there must be a starting tile (where you begin playing the hole) and an ending tile, containing an actual “hole” (the actual cup) for the ball to go into.

 

 

Choosing/Placing Objects: When Build Mode is entered, the left controller produces a curved ray. Similar to the teleportation ray, the placement ray’s depth (how far the target appears from the player) can be increased by pressing the left thumbstick Up, and decreased by pressing it down, from a minimum of 1m to a maximum of 10m.

 

In the area where the ray meets the ground, a semi-transparent tile should appear, indicating a candidate tile for placement. The user can switch their choice of tile by pressing left or right on the left thumbstick, and the visualized tile will update accordingly. When the user presses the left grip button, the tile will be placed at that location. The object should be placed on the ground – not hovering over it. The user can’t place new tiles over existing tiles.

 

 

Tile Types

Your project must support multiple “tiles” - boxes of equal length and width, but height of 0.1m. These should have 0-2 “bumpers”, that is, small walls (also boxes) along the edges to prevent the golf ball from falling off the sides. The tiles should be green; the bumpers can be any color you like. The tile types are:

-       Starting Tile – 0 bumpers. Should be colored blue to distinguish it from other tiles.

-       Ending Tile – 0 bumpers. This can be made with 5 boxes – one serving as the “base” and the other four arranged on top of it to make a hole (a cup) in the center.

-       0-bumper Tile

-       1-bumper Tile

-       2-bumper Tile:

o   Corner – the bumpers are perpendicular, and

o   Straight-away – the bumpers are parallel

Figure 2. Examples of 2-bumper Tiles: a straight-away tile (left) and a corner tile (right).

 

Adjusting Objects Before Placement: In Place Mode, all placeable objects must face one of four directions (+X, -X, +Z, -Z). At the location of where the left controller’s curved ray hits the ground, a semi-transparent copy of the object should appear. The user can change the rotation of the object before placing by pressing left or right on the right thumbstick, which will update the copy on screen. Once placed, the object becomes opaque (non-transparent).

 

Snapping Tiles: Tiles need to be placed so that they align; if there are gaps or overlaps in tiles, it will cause issues when playing golf. Thus, your code must (conceptually) divide the world into a “2D grid”, where each point on the grid is a location where a tile can be placed. When the placement ray of the left controller hits the ground, the transparent visualized object should not appear directly at that location, but at the closest grid point to that location. 

 

Tiles cannot be placed over other, existing tiles in the scene. If you’re placing tiles and the nearest grid point is occupied by an existing tile, no semi-transparent tile should appear at that location, the existing tile should change color to red temporarily, and the user should be unable to place a tile there.

 

Play Mode

Once a hole is constructed, the user can play mini-golf. The user will need to hit the ball with a physical motion of striking the ball, and put the virtual golf ball into the cup (the actual hole in the tile).

 

Golf ball: The 3D model of the golf ball can be downloaded from an external source. The ball must follow two of the basics of Physics, Gravity and Collision. For example, the ball needs to fall if it goes into the cup, and bounces off if it hits a tile of the golf course. You may use the Physics component in Unity. If the ball collides with the bottom of the cup on the ending tile, golfing ends and the user is automatically moved back to their original position.

 

Golf club: The 3D model of the golf club can be downloaded from an external source. The club must also follow two of the basics of Physics, Gravity and Collision. If the ball was struck by the club, it must move. You may use the Physics component in Unity. The club should only be able to “hit” and move the golf ball; however, it should follow the laws of physics. For example, the club should not ghost through the ground or other objects.

 

Entering the game: The user can enter a hole by teleporting onto the starting tile, where a golf ball spawns automatically. A golf club is attached to the user’s left or right hand, and the controller/hand models from Build/Navigation Mode are made invisible, disabling teleportation. The golf club should be attached to the controller such that when the user holds their controller with their thumb towards the ground, the club should be properly oriented (ready for the user to hit the ball).

 

You may need to adjust the physics of the ball to adjust how it responds to being hit. The ball should be able to be hit with a light tap without falling off the tiles, and should “bounce” off the bumpers of the tiles as well. When the ball stops, the user should be repositioned next to it so they can hit it again, unless they get it in the cup, in which case they are automatically moved back to their last off-tile/off-course position.

 

Depending on the angle of the hit and force used, the ball may fly off the tiles. In such a case, if the ball hits a non-tiled terrain area, or falls below the height of the terrain, it should automatically respawn back at the location it was hit from.

 

The number of times the ball is hit during golfing should be tracked. Depending on the number of hits it takes to get the ball into the cup, a certain sound should play before the user is returned to their last off-tile/off-course position. If the user is able to get the ball in the cup in three hits or less, a “triumphant” sound should play; if four or more, a “defeated” sound should play. You can choose which sounds to use for each. The golf club should be removed from their hands, and teleportation re-enabled.

 

Note: the golf club and ball do not need to be regular size – it may be easier to hit a larger golf ball, or to use a larger golf club.

 

Developing without physically having the Oculus

You will be sharing an Oculus Quest with two other students, thus, you will not have access to the device all the time. We advise you to implement and test your code on a VR device simulator in the Unity editor in advance, then, deploy your code on the Oculus Quest. One example device simulator is Unity’s XR Device Simulator. Note that the submitted version of your assignment must be executable on the Oculus Quest, the simulator is only for the development.


Extra Credit

Extra credit of up to additional 10% of the assignment value in the final grade will be given to extra functionalities and/or features that you implemented for this assignment, including at least 7 types of advanced geometry tiles (e.g., slopes or hills, curved corners), an advanced selection menu for tiles, “sand” versions of each tile which slow down the ball, and/or advanced placeable obstacles (e.g., windmills). Please describe the extra funcftionalities and/or features in your report.

Submission

It is strongly recommended that you test your application before submitting your work. Please save and zip your Unity project in a folder named “CSE566 Assignments” in Google Drive and enable the share of this folder rather than sharing the single project file. In Brightspace submission, please submit the link to your Google Drive folder.

 

For this assignment, include the following for full credit: your Unity project folder, a report, and a video. Your Unity project folder should contain your Unity saved scenes and all your Scripts and Assets that will be required to rebuild your project. Please do not include your project executable in the folder.

 

You will also need to upload video recordings for your application. For the first-person view recording, turn on screen capture on your phone and run the VR application, then, export it to a video file. For the second-person view recording, you need to demonstrate your interaction within the scene of your application from a second person’s perspective. We advise you to get assistance from your peers to record this video (Example link). Make sure you show all aspects/functionalities of the assignment, including but not limited to the scene objects and the interactions.

 

For your report, you should include at least the following:

-       A title: “CSE 566 Virtual Reality, Spring 2023, Assignment 3: Advanced VR”

-       Your name and Stony Brook ID

-       Unity version

-       Hardware used

-       Directory hierarchy

-       Any extra functionalities/ features that you implemented for this assignment

-       Details on implementation: references to the downloaded 3D models or how you designed your own model; how the controls were implemented; how the golf game was implemented; to mention but a few.