Skip to main content

Final VR project - Blog2

 Hello everyone,

This is going to be our last post, we enjoyed a lot working on mixed realities in Unity and we are sure we will use the knoledge we have acquired in the future.

On this one we will comment and explain some code snippets:


MatChanger.cs: Game Menu Controls

To control the game menu / instructions panel we wanted to put some buttons on the bar counter but we had some issues with that and we weree running out of time so we finally put the buttons under the screen where it is all showed.
This is the code we use to controll the 2 buttons we have, one of them to navigate through the cocktail menu, and the second one is to get started and go to the next slide:



Here, a 2 dimensional array with the name of every material for the screen is created. We use CocktailNr to save the first index if the array and SlideNr to save the second index. On Start, we assign the Slidescreen.



This functions are called after we press the UI buttons below the screen. They increase SlideNr or CocktailNr and call the UpdateScreenMat function with the updated indexes. The UpdateScreenMat is explained in the following.



It loads the correct material based on the Name. Afterwards it changes the material of the previously assigned Screen.


Streams.cs: "liquid" stream



lineRenederer: Displays the pouring stream.
splashParticle: Creates the particle "splash" effect on the end of the stream.
pourRoutine: Responsible for the updating pouring based on degrees of the bottle. 
targetPosition: Detects the bottles' degrees.

 

FindEndPoint() creates a raycast from the top of the bottle straight down until it detects collision, and pours to the detected spot. 



AnimateToPosition() creates the animation for the pouring of the stream with the a given speed Time.deltaTime * 1.75f.


PourDetector.cs: Detects the pouring



pourThreshold: If the transform.up.y is less the 45 degrees we pour.
origin: starting coordinates where the pouring is coming from.
currentStream: will create the pouring streams based on the if stament below.
Update(): Checks if the pouring is happening and will StartPour() or EndPour() based on the treshold.

If you want to try it by yourself, the project is already completed and uploaded on our github repo: https://github.com/Yasin-0109/Bartender-Tranning

Sadly, this is all for this course! We had great fun developing the applications for AR and VR, and we hope you enjoyed checking our progress updates on the blog.

I recomend everyone interested in coding to check out this technologies and see its possibilities, for sure we will keep doing it so stay alert just in case we decided to start another blog about other work we do!!

Comments

Popular posts from this blog

2nd AR Project - LEARNING through AR! - Week 41

 Week 41 Having the main idea of the project defined, we started the second week of development organizing the tasks in our group. We all took some tutorials on how ARCore works to get a main idea and functions that might be useful. Later on we started working with interfaces, canvas and buttons and we struggled with their size and interaction. So our main idea was to have an interface in front of what the user is watching (that in this case will be the video comming from the camera) that allows them to select between diferent colors to change the colour of the wall.                                                  First version of the interface An out of scope feature that we could implement is to improve the interface offering the user the possibility to select from the whole color palette like pantones...

1st AR Project

Hello everyone, We are a group of software engineering students: Yassin Aden, Pau Francino, Boris Llona and Roger Weber. We are taking a Mixed Reality course at VIA University in which we will learn about both Augmented and Virtual Realities from a practical approach. In this DevBlog we will keep you updated on every step we take. On our first project we have been assigned to do a basic AR game to get in touch with the technologies involved. This project is to be done using Unity5 to develop the game, and the extension "Vuforia" to display AR objects on the image targets . As none of the group members had any previous experience with those programs, we had to follow some online tutorials to learn the basics. After a brainstorming session we collected the best ideas, evaluating them in terms of practicability, creativity and effort needed, and finally selected the idea we all liked the most taking in account the 2 weeks time limit: an Augmented Reality Air Hockey video game. I...

1st VR Project Blog1 - Bowling on Oculus Quest!

 Hello everyone, This week we have started our first project on VR. For this application we are using Unity5 and Oculus Quest. Released on may 2019, this headset is totally wireless, which gives wider movement freedom, though it obviously has less processing power than a computer. As none of the group members were familiar with this technologies, we took some basics tutorials on youtube on how to get started; how to configure the project, which packages to import and other tecnical issues that needed to be solved in order to start the project. After messing around with the device and playing some games on it, we had a meeting where we decided to do a bowling game. It was then when we realised that we would need to meet physically in order to work on the project and being able to test our application on it, which is an issue that we didn't have when working on AR as we could test it on our phones. The testing also takes more time, both for the building process as for the actual test...