1. O
    1. Oculus Best Practices Guide
      Reading Content
  2. U
    1. Unity
  3. V
    1. Virtual Reality, LaValle 2016
      Reading Content
Completed: / exercises

HW: Twister

Due date: 2023-09-20 23:59.
Could you move that cube on to the other cube with just your gaze?
Your task is to implement an interaction system that's convenient to use even when your only form of input is the head tracking. The idea is to interact with objects by rolling your head to the left or right. Simple, right?
A good method of interaction should provide feedback to the user so they understand what's happening. Imagine that you have a crosshair like this in the middle of your field of view in VR, visualizing what you are looking at:
Then imagine that when you look at an interactable object, another such crosshair appears, but rotated by 45 degrees and overlapping the other one, looking something like this:
Whereas your own crosshair would rotate if you roll your head, the other one would not. And so, to interact with this object that you are looking at, you must make the crosshairs line up by rolling your head. In VR, it could look like this:
By rolling your head, the object can be interacted with, in this case grabbed!
If you wish to think of a different way to visualize this interaction, feel free! For the crosshair, it's recommended to download this package, which includes that basic texture, but also a shader which allows it to be always drawn on top of other objects. Feel free to modify the texture or other aspects as you wish, however.


There are many ways this could be implemented, so if you already know what to do, feel free to do things your way. But if you want a little more guidance, follow the instructions here closely.
Create 2 empty GameObjects under Player, let's call these "Crosshair" and "Lock", and create planes under them. Planes by default are facing the wrong way, so with this kind of hierarchy we can easily adjust the orientation of the crosshairs. Make sure the planes have their position set to 0 and X rotation to 90 so they face toward the camera. Apply the crosshair texture on these planes. The resulting hierarchy for the player in the scene should look like this:
-Main Camera
Feel free to adjust the position, rotation and scale of the crosshairs such that they are in the middle of the field of view, facing the player and appropriate size, but note that they will be further modified by the script.
Next, create the script that will drive the interaction. You can attach it to "Crosshair" for example, but the important thing is to have references to the "Crosshair", "Lock" and "Main Camera". This script should do the following:
Feel free to create any kind of interaction you wish using this system! It could be simple like changing the color of something, making something move, or whatever you think of. Note that grabbing is a bit more complex and not recommended to start off with.

Question 1

Which of the following is a suitable function call to rotate the object to match the roll of cam?
Warning: You have not logged in. You cannot answer.

Question 2

How can you calculate the angle between transform.rotation and lock.rotation?
Warning: You have not logged in. You cannot answer.

Submitting Your Work

STEP 1: Create the APK.
As you have probably already done, create a build by going into the build settings. Whether you choose Build or Build and Run, it will create the APK. This .apk file contains your app, and can be shared to others.
STEP 2: Write notes about the app you created describing what you implemented and how, and any instructions if required.
STEP 3: Add the .apk and the readme file into a zip file, upload it into your preferred cloud service and put the link in the answer box below.
Note that any submission here is graded as correct.

Warning: You have not logged in. You cannot answer.


Elmeri Uotila
Informative Guides to Help You Design, Develop, and Distribute Your VR App.
The platform for interactive, real-time, 3D content creation.
Virtual Reality, LaValle 2016 is the free online textbook we use in this course.