Completed: / exercises

HW: Twisters, User Friendly UIs

Due date: 2024-09-11 23:59.

Before starting...

If you haven't done it yet, we recommend setting up version control as a way to help avoid potential problems that could cause you to lose progress. Here is a quick tutorial: GitHub Desktop for Unity

Interactions in 3DOF VR

Have you wondered why interaction is limited in all the Cardboard VR experiences you’ve tried so far? Without 6DOF positional tracking and controllers, Cardboard VR doesn't allow for simulating walking, grabbing, or many other interactions possible with high-end HMDs.
Until this homework, that is.... It turns out there is a way to create meaningful interactions, even with 3DOF orientation-only tracking systems.
Let us look at the example in the image below:
Could you move that cube on to the other cube with just your gaze?
It turns out you can! To see how it can be done - start with downloading and running the .apk we have created for you:
This .apk serves as a solution for the homework below. After you complete it, your Cardboard VR experiences will feature meaningful and exciting interactions, enabling you to create outstanding VR projects.
Will you create a killer app by the end of this course? We surely hope so!

Tasks Description

Your task is to implement an interaction system that's convenient to use even when your only form of input is the head orientation 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.

Implementation

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:
Player
-Crosshair
--Plane
-Lock
--Plane
-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.
Hints:

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.

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

Authors

Elmeri Uotila, Anna LaValle.
?