Semester B: Week 41
Student: Tai Ser Yeet (22064351)
Programme: BA (Hons) Digital Media Design
Task: Week 41's Class Task (Part 1)
WEEK 41
[UNITY]
5.5.24
This week was the week that I dreaded the most because the functions that I am about to integrate into my 3D model to make it interactive require a fair bit of code. In the previous classes, Josh gave me a few keywords that optimized my search for YouTube tutorials regarding the few functions.
Scale & Rotating Sliders
I begin by following the tutorial below on using UI sliders to scale or rotate the 3D object. The tutorial also provides the code so it was fairly easy to follow.
When it came to testing the effectiveness of it, several issues surfaced. For instance, the sliders worked as claimed but the 3D object was not visible on screen. I tried adjusting the distance between the AR camera and the 3D model but no luck. That attempt was the model without the image target as its parent element. In the second attempt, I placed the 3D model back on the image target and tested it again. The 3D model appeared when the image target was detected but the sliders did not function properly.
Pointing Labels in World Space
There wasn't an exact tutorial specifically teaching how to create floating labels that were tied to a 3D object FOR AN AR APP. Nevertheless, I picked tutorials similar to what I have in mind and just went with it. It was definitely difficult because most of the creators were mainly focusing on labels which included health bars, and other elements related to a game they were making whereas I was making an educational AR app.
6.5.24
Sliders
It is the next day and I am following another tutorial on the slider but there was one downside to it. The tutorial was tailored towards AR Foundation and not ARCore. However, I still gave it a shot because according to the online articles, both software share similar traits.
In Visual Studio Code, I created a script for the rotate and scale slider.
Returning to Unity, I constructed a new prefab and placed my 3D model inside the asset.
After that, I added the script component under the prefab and inserted the appropriate min and max values.
Now the moment of truth. IT WORKS! SUCCESS! I am so happy because this was one of the major functions of the app. This breakthrough opened up alot of doors because I can now follow along tutorials that use AR Foundation which works just as well.
Reset Button
I wanted a button that allows users to return the 3D model to its original state in case they wanted to try out a different angle. I have attached the tutorial that guided me in successfully creating the function.This is the script that I attached on the AR camera. All I did was played with played with the Scene Manager to reset the game. I was satisfied with the results eventhough it wasn't as I envisioned but as long as the code resets the scene, I am fine with it.
Reattempting Pointing Labels in World Space
I tried making the labels work again and also watched several more YouTube tutorials.
In a new canvas, I inserted a button serving as a label for the shell, enabling users to open a panel containing explanations of each organ's function. I also made sure that the canvas was within the perimeters of the main camera. Once that was done, I copied and pasted the canvas into the prefab for the oyster shell and adjusted its position accordingly.
I noticed a few issues right away and one of them was that the label was backwards so I fixed temporarily by making the entire shell upright. To make the label face the camera when the user moves the card around, I wrote a short code following the tutorial below and so far, it works!
Eventhough I used a button as a label, it was unusable when I entered into game mode and I am not certain why.