CS 498: Virtual Reality MP 2 : Scripting & Depth Perception (UPDATED) Due March 3rd This assignment will demonstrate the difference between rotation and position tracking, make you realize how much depth perception relies on them, and teach you how to enable and disable them. It’ll also help you understand the rigid body transformations covered in class. We have provided you with a .unitypackage containing a scene(‘MP2’). The provided scene contains an OVRCameraRig prefab, which doesn’t allow player movement but still uses DK2’s rotation and position trackers to modify camera position and rotation. The prefab contains scripts (OVRCameraRig & OVRManager) that you’ll modify in the following ways: 1. Pressing the ‘r’ key enables/disables rotation tracking. 2. Pressing the ‘p’ key enables/disables position tracking. You will need to modify the scripts to disable rotation and position tracking . There is no menu option to disable rotation tracking, and unchecking the “Use position tracking” box in the Unity editor has no effect in the current version of the Oculus Unity integration. You should notice immediately how much rotation and position tracking contribute to immersion and comfort in VR. You really don’t know what you’ve got until it’s gone. Part 1 - Depth Perception & Relative Size The scene contains a parent gameobject called StimulusManager with 3 child gameobjects: Small, Medium, and Large. Your job is to write a script (‘GenerateStimuli’) that arranges these objects so that they appear to be roughly equal size when viewed from the default camera position (sitting comfortably in a chair at a normal distance from the desk) with rotation tracking and position tracking disabled. You should be able to activate the script by pressing ‘s’. Here is what the script should do: 1. Make the 3 objects disappear (by destroying or inactivating them). 2. Randomly assign the 3 stimuli to be in left, center, or right position (from the perspective of the camera). There should be one stimulus in each position. 3. Determine where to place the stimuli so that they all appear the same size from the default camera position. You can do this by generating all possible stimulus positions in advance or by doing the math on the fly. 4. Wait 3 seconds, then make the left stimulus appear. 5. Wait 3 seconds, then make the middle stimulus appear. 6. Wait 3 seconds, then make the right stimulus appear. This is how the stimuli should look when they are correctly placed: Once all stimuli have been generated, pressing the ‘s’ key again should start the whole process over again. Part 2 - VR Mirror Create a script (‘CameraFlipper’) that flips the OVRCameraRig 180 degrees when you press ‘f’, like you were turning around to look behind you. Now you should be facing a transparent window with a floating cube face on the other side. Think of this cube as your head. Write a script (‘VRMirror’) to modify the position and rotation of this cube to match or mirror your own. Pressing ‘m’ should make the cube match your own movements. In other words, it should be like a third-person perspective of your own head (you should see the back of the cube’s head in this mode). In this mode, when you move your head closer to the window, the cube moves further away from the window. When you look left, the cube should also look left. Pressing ‘m’ again should make the cube mirror your own movements. In this mode, the cube should face you and when you move your head closer to the window, so does the cube. When you look to your left, the cube should look to its right, like in a mirror. Pressing ‘m’ should cycle through these 2 modes. Rubric: CameraManager Script 1 10% Pressing tab resets camera position to 0,0,0 AWARDED AUTOMATICALLY CameraManager Script 2 10% Pressing ‘r’ enables/disables rotation tracking CameraManager Script 3 10% Pressing ‘p’ enables/disables position tracking StimulusManager Script 1 10% Objects disappear and reappear in the correct order and position, with correct timing StimulusManager Script 2 10% Script can be run repeatedly Perception 20% Stimuli appear roughly equal size once the StimulusManager script has been run VRMirror Script 1 10% Pressing ‘m’ makes the cube match your movements VRMirror Script 2 10% Pressing ‘m’ again makes the cube mirror your movements VRMirror Script 3 10% Can cycle between Match and Mirror modes
© Copyright 2024