raw_content: Unity Tutorial Part 1 : Discover Voice Controlled AR, With A Cloud AI ✅
  Diego Herrera, Unity & Augmented Reality Developer
  Watch this class and thousands more
  Get unlimited access to every class
  Taught by industry leaders & working professionals
  Topics include illustration, design, photography, and more
  Lessons in This Class
  56 Lessons (10h 15m)
  1. Unity Tutorial, App Development, Augmented reality, Game Design
  2. Welcome to the Unity AR Plus AI Course
  3. AR Ten Minute Challenge
  4. Choosing The Right Bot
  5. Choosing The Bot Continued
  6. Your First AI Bot
  7. Creating The Car Bot
  8. What Are We Making?
  9. Project One Intro
  10. Project One Continued
  11. Project1 intro Cleanup
  12. Project1 intro Part2
  13. Car Selection Script
  14. Cycling The Buttons
  15. Intro To Particle Effects
  16. Out Particle Cloud
  17. Completing The Car Intro App
  18. Cleaning Up
  19. Making Unity Connect To The AI
  20. Making Unity Connect To The AI Part2
  21. Code Explanation
  22. Code Explanation Part2
  23. Custom UDT
  24. Opening The Car Door
  25. First AR
  26. Starting The Engine
  27. Exporting To Android
  28. Exporting To IOS
  29. My Field Test
  30. Colours & Bots
  31. Changing The Colours
  32. Searching A Containing String
  33. Window Animations
  34. Opening The Hood
  35. Opening The Trunk
  36. Playing Video
  37. Tocus - Open Doors
  38. Tocus - Windows
  39. Tocus - Hood
  40. Tocus - Trunk
  41. Tocus - Video
  42. Lambo Doors
  43. Lambo Windows
  44. Lambo Video
  45. Porsche Animations
  46. Upgrading The Handle
  47. Upgrading The Handle Part 2
  48. Improvements
  49. Video Fix
  50. Audio Fix
  51. Sliding Panel
  53. Ground Planes
  54. Ground Planes Part 2
  55. Ground Planes Summary
  56. Outro
  Community Generated
  The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.
  About This Class
  THE UNITY COURSE YOU WANTED IS FINALLY HERE!
  Augmented reality with voice commands. My most anticipated course is finally live. After many hours of research and development I found the fusion between the latest Augmented Reality technology from Vuforia, the Unity game engine and a voice controlled cloud based machine learning AI.
  As a student, business owner, developer, marketing executive or IT professional, it's vital to stand out from the crowd and with the skills you will learn on this course you will do more than just stand out.
  The primary objective is to create 'Real World' augmented reality applications, mixed reality apps that can be used to boost sales by impressing the client so much, they will have to share your apps with everyone they know.
  A common trend with AR courses is to demonstrate the technology by creating simple mini apps, projecting a 3D model on a surface in front of the user, this is usually done with an image target or possibly a ground plane. Although this is... 'cool' it doesn't capitalise on the marketing power AR offers. On this course you will break this trend by creating beautiful apps fit for commercial demonstration to potential customers!
  This course is completely hands on, we learn by doing (plus a few scripts I give you as time savers). Together, we use the latest versions of Unity (upgrading to 2018 mid way), Vuforia and the online AI bot. No additional in course purchases are required along the way and all materials are provided. Beginners to this technology and computer programming are more than welcome.
  Diego Herrera
  Unity & Augmented Reality Developer
  Hello, I'm Diego. I owned a digital agency for 16 years in the UK before recently relocating to Spain and having a change in direction. My experience covers an array of programming languages and I have a passion for new technology in the digital field. I started developing in 2002 and have personally worked in numerous fields including web, app development, multilingual software and 3D. I have also released patent pending technology for software created for the UK National Health Service (NHS), specifically the national ambulance service. Throughout my time I've trained internal and external staff assisting various companies with their own required software training.
  I now spen... See full profile
  Technology Mobile Development Game Design Cloud Marketing App Development Unity 3D Coding
  Hands-on Class Project
  In Part 1 we look at creating a fantastic AR Car Performance Application and learn how to connect Unity to an online AI.
  Part 2 (Uploading Feb 4th) Then extends this knowledge and looks at creating a real estate application with virtual buttons and a first person camera virtual tour.
  Resources for the course are attached :
  Expectations Met?
  Exceeded!
  In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.
  Why Join Skillshare?
  Take award-winning Skillshare Original Classes
  Each class has short lessons, hands-on projects
  Your membership supports Skillshare teachers
  Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.
  Create An Awesome Augmented Reality App
  Game Development - An Introduction To Unity® For Absolute Beginners
  Unity 2D and C# for beginners
  Ekaterina Usova
  Unity Quickstart - Make your first game without coding
  Bhaumik Patel
  1. Unity Tutorial, App Development, Augmented reality, Game Design: Hello, everybody, and welcome to my fantastic new course on voice controlled, augmented reality applications. This course is truly unique and has one of the best criteria that I have across all of my courses, and I want you to join over 30,000 happy students along this journey. Now what we're going to do on this course issues the unity three D gaming engine. The View four year image recognition software Andan online, bought to create commercially viable, voice controlled, augmented reality experiences Augmented reality is becoming increasingly popular on looks fantastic on any developers portfolio, along with any professional who would like to demonstrate a port of service or company in an innovative way. So let's have a look at the curriculum and see exactly what you're going to learn. Our first point of call is to jump across to the Unity three D website, where I give you step by step instructions on how to install the latest edition. Make sure that you have all the required packages for your learning experience after this region, right across to the Euphoria Website, where we upload our first image target and I give you a brief introduction on how the image recognition software actually works. It's then time to move back across team unity and create our first application. The A R Car performs up. In this section. You'll learn how to create an amazing intro, singing where you can cycle through three D models and use particle systems way, then progress further into the course. I teach you how to do your first augmented reality experience. And then it's time for our first field test in field test one. You'll get to experience what it feels like to see a full size Lamborghini spawn right in front of you. And even at this early stage, I will have taught you how to send your voice through toe on online baht. Return information on manipulate a scene right in front of you throughout the cause. Not only do you learn how to create amazing commercial applications, but I give you hands on experience with the popular programming language C Sharp are. Once you've gained the confidence to upgrade your code, it's time to go out for a second field test when you'll get to try out new voice commands to control a three meter real world scale video screen new animations and even changed the color of models right in front of you. Or what's left then is to complete the Ark and exported to our device in project to your build your second commercial application, the A R. Kasse Real estate. We expand our knowledge and you'll learn about virtual buttons and how to interact with three D models. We then use this knowledge to activate the first person camera mold when you can use a mobile joystick and actually walk around the three D model. This really is a fantastically packed out course. Guys. Not only do I teach you step by step, how to create an app and exported to your device, but it's backed up with solid support, my own personal student support forums. So what are you waiting for, guys and roll today and start your experience 2. Welcome to the Unity AR Plus AI Course: Hello, everybody and a big thank you for taking my fantastic new course on voice controlled, augmented reality applications with the machine learning artificial intelligence bots. This is going to be fantastic, guys. It's by far got one of the best curriculums across any of my courses. We're going to use the most up to date software available across the board on I'm really aiming to stand out to put together some applications that you can use in the real world. We're not just going to build on augmented reality experience, which makes a model appear in front of us. We're going to build riel applications that will look fantastic on a developers portfolio. They will work smoothly and transition across seamlessly across into the rial business world. We're going to build a car showroom application where you can dynamically change the colors of the vehicle that you're looking at. We're going to build a car maintenance application. We're going to build a really, really estates application and many, many other things. I'm also going to jam pack. The course with Resource is downloadable files, audio files, a few of the scripts that you're going to need. We're going tohave riel field tests. We're going to have quizzes along the way. It's it really is a jump act course, guys. So let's get into it on. Let's get going now, in order to make this come together in the course, we're going to need to pieces off kids. The first thing that we're going to need is the Unity three D software, which is free to download from unity three d dot com. The second thing we're going to need is of euphoria developer account so that we can actually upload our targets into the unity software to create our initial augmented reality experience. Now hold Hold on a second, guys. If you've already got one installed, just bear with me. Don't skip the video yet. I'm just going to give you guys a quick, brief overview. Now, this is the unity three d website. So if you don't already have unity, the latest version to date where in January now of 2000 and 18 is unity 2017.3. You're going to need two things here. First thing is up in the top right hand corner. You're going to need a free unity. I d don't don't sign up just yet, because I want you to do that while the software installing what I want you to do is come across to where it say's get unity, just click the button. This will take you through to the Unity three D licensing page. Now, if you've already got unity installed, but it isn't the latest version. What I want you to do is download the latest version over the top of your existing software . Now just bear one thing in mind. Those guys before you do that, if you're halfway through a project, what the new software will do is it will upgrade the existing projects that you're working on, so you may have a couple of errors. So that's just a bit of a disclaimer between software. It could cause an initial current project to break, and you may need to address a couple of issues. So please consider that before you will create the suffer. Now for everyone else, we have three license options. I want you guys to just simply use the free personal addition. There's no charge for the software on until you hit over $100,000. Then you won't need to upgrade your license. I've currently got a pro license. So my software will look slightly darker in the color scheme than think Personal edition, which is a gray. Now, if you've already got unity, scroll down and click. Download unity here on that will download the package installer to overwrite your existing software for everyone else. For just go back for a second. I want you to click. Try personal. Okay. This will take us through to the download page, agree to the terms and conditions on download the installer now. Okay, so that's downloaded. We're going to open up the installer. Andi, just jump through for a second through the usual suspects where it asked me the options for downloading the software. The reason I've included this section in the new course is because they've changed the installer. So I just want to cover for you guys on. If you come down, I want to cover this area here. Make sure that euphoria augmented reality has bean activated here as well. Now, the required packages for this particular course is the top four. We need the unity software. We also need model developed, which is some software which bundles with unity where we write our code, we need the documentation on the standard assets on. We're going to cover both Android and IOS, so these two definitely need ticking as well. The one not to forget, though, is of euphoria augmented reality. Now, once you have all those selected plus any additional ones that you may want to click, continue and proceed with the installation. While that's downloading, I want you to come across here and create yourself the unity I d verify the email address and then come back. So pause a video. Now on the way we go. So the second thing that we're going to meet is of euphoria developer license. Okay, so just jump back to the main view for your page. Okay, So euphoria is a piece of software that works with unity on it will actually create our augmented reality experiences for us. We need a license. So if you jump across to the deaf porter and then click on log in or register, I've already got an account, so I'm just simply going to log in for a second. If you don't just pause again on registers. The usual suspects of name and email address on their Once you have an account, let's log in. Now What we need to do here is we need to get a license key, which is free until we use it for commercial purposes. So what I want you to do is click on get development key on. We need to copy and paste this into the unity software once we move on to the next video. So I'm just going to call my development license key. A deaf key. Okay, nice and easy. Check the box and confirm. And what this will do is create a deaf key license for myself. On what? On which simply going to do is copy this license key to my clipboard. There we go. Now there's no needing copying my cold. It's a free license. Anyway, you might as well just get your own guys. So the second thing that I want to do is I want to then go across to target money, Jack. The way that before it works, is you can what? Load an image to their system. They will then give you a file that you can import into unity on the view. Fauria software will look for that image as a target. When the image is found, then the augmented reality three D object will be superimposed on top of that target. So the way that we do this is by adding a database to the view for your website. I'm just going to call it deaf kits A. Are it doesn't really matter what the database is called. As long as I remember exactly what it's for. I want it to be used on my device so I can just simply create database on. Now. We've got a database created inside the target manager under the development area. I convey, not go inside my database and upload an image target to their system. And this is a reason why I didn't want the you guys who have already got the software installed to skip through the video because you're going to need this image target for the next video. So let's click on target. So I want you to click on Single Image on, then browse for the file that we that I've uploaded for you guys. So just pause a video. Now rub the file and come back. Okay, so inside here. I have my picture off the lump beginning now. This is a decent image to use because apart from the clarity, there's a good contrast between the different colors on the background. So the software should be able to isolate certain areas of this image and give it a good star rating for us to use. That means that the software will find the image easily in the real world. Now, once you've attached a file, I'm going to give it the width of 10. The name can remain Lambeau. I don't mind and upload the image target. Okay, so we're flying. Guys were flying. We've got a unity installed. We've got the euphoria developer account logged in on. Now we've uploaded our first image target, and you can see the rating is a five star. So if I just click on my target for a second, I can give you guys a demonstration on what that actually means. If I just come down to where it's a show features, you can see how their software has isolated certain image areas on bond shows us that there's plenty for the software to see through our camera. So inside unity we're going to upload this image on, then, when we run our augmented reality experience, as soon as a camera detects these identifiable markers, it will be able to superimpose the augmented reality object on top of our image in the real world on That's fundamentally how the software works is basically image recognition software. So let's come back upper level for a second to the deaf kit. What I want to do is just download this database. I'm going to select the image and click download database. I want to download it for unity. Andi, download on. There we go. So what we're going to then do is use this downloaded file and loaded inside unity. So Unity has some software on a database ready which contains the image. Then when we run the camera, it will look for that image and find a much on Douala. We will have our first Hello a our experience. So hopefully you guys haven't hit any hurdles. I wanted to skip through the installation on this video because the majority of students already have a unity created our first image target. Inside of euphoria, we've download it. I just come out of this for a second that we go rejected. We've downloaded the database. Were ready to go. OK, so in the next video, I'm going to set you on myself a 10 minute challenge. We're going to create our first augmented reality application in 10 minutes. So challenge accepted. I'll see you in the next video. 3. AR Ten Minute Challenge: Okay, guys, it's challenge time. Now. The aim of this video is to prove that from North in, we can create our first augmented reality experience in under 10 minutes. Now, all I've done so far is I opened up the unity software and I've purposely logged out in case this is the first time that you're doing the same. So this is why we needed a unity account. I'm just going to log in for a second. There we go, Poppy. In my past. Really? Fact, you remember it on click Sign in. Now, I'm faced with a list of existing projects. If you're new to this, then you're probably going to be on the learned tab. But either way, we're going to open a new project on. I'm going to call mine the 10 minute challenge because that's what this is. We are going to use a three D template and we're going to use our image target off the Lamborghini to trigger off on augmented reality experience. Now, if you haven't got it already, what I want you to do is get the image off the limbic unit. This thing Andi, I want you to either print it off, ready to be used in the challenge. Or if you don't have a printer, just send it to your phone. Andi, the software will work just the same if you hold the mobile device up in front of the camera now, what we're going to do is we're going to create an augmented reality camera on the project . We're then going to import our database, configure the camera toe, look for the correct database on. Then we're going to download a model to be used as the augmented reality experience based on when the camera detects from the identifiable marker points on this image, it will then look for the identifiable marker points on. Should it find them, It will then use the image tongue as a location to superimpose our three D model on top. So can we do it? Here is money timer. I'm going toe out 10 minutes to the timer on hit. Go. Okay, guys, the clock is ticking. So first thing that we need to do, we need to set unity up to use augmented reality at the moment. Inside the game view, it uses the default scene, which is nothing at the minute, That's all. The camera can see our little three d world off nothingness on this little skybox around. Now, we don't want to use this camera, so I'm just going to delete the camera. What I want to use is of euphoria augmented reality camera. Now we need to go into the build settings first. I'm activate that so file build settings on. I'm gonna use Android today and switch the platform. And then what we're going to do is going to the player settings and enable something called the X are settings which will tell unity that when we press play, whatever the camera is on the scene, I wanted to be an augmented reality camera. Therefore, what it will do if I just moved myself for a second is attached a couple of extra scripts to the camera on Activate the Webcam. The webcam will then be used as the background on our seat on. That's effectively kind of the image on the method that this software is put together. So make sure that your ex are settings, which is the last tab on Just click of euphoria augmented reality Onda. That's everything set up ready now So let's go to the game object. Button up the top, and we need to go down to view Fauria, which is now integrated with unity, which is so much easier compared to a couple of years ago on I want you to click to add an a R camera. It wants to out a couple of assets, so just allow it to do that now. What this will do is it will create a camera with the required scripts already attached. So what I press play it will activate. My webcam on the game view will turn into a camera because it's using a texture on top of the camera on top of the scene on placing the image sent from the devices camera on top of that texture. And that's kind of how it works. Now what we need to do once this is finished, updating there we go is now come down to the bottom right click on imports package on the package that we want is the custom package off the deaf kit A. Our database which contains our Lamborghini graphic Here it is look scaled down. So when I click import, he will add the database information from the view for your website into our scene. Now that's done. That means I can click on the camera, make sure everything is configured. How I wanted to just move myself to the side on Grab my license key for a second that we go . Okay, now, if I open the before your configuration now we go. I can paste in my license key off the top. Now, the other thing that I want to do is to use something called extended tracking. Now, to do this to explain this, I'll give you a quick demo if we go game object of euphoria on go to image. This will include an image target on it creates a game object on the scene that we can use as a target for the camera to actually find issues in my mouth. My right bottom, Teoh, Zoom around. If you're wondering how do in that guy's now you can see that when we create to this I set out to be 10 grid units wide on. I know that the size of the graphic the image I'm using is an A four image. Therefore, I can use this as a reference to scale How big I want the model toe appear based on the size off my graphic and the scene on that's really 100 for the image target. To do that now for click on the image target in the Inspector, you can see that we're using a pre defined target rather than a user. Defined are cloud based target the databases of one that I've just imported, which is my death kit and only contained on image. So it's defaulted to my Lamborghini, which is how we've got what we've got. Okay, so now what I want to do is ultimately placed a three D model on top. The way that this works is a camera will look for the image target on, look specifically for the identifiable markers will then superimpose the image of the object on top of our target. Now, that's great boat. If you move the target out the camera, the target is lost. Therefore the model disappears. Now, when I want to do is enable something called extended tracking on that, you used to be inside the image target under the advanced tab on a little check box here. So if you're using 2000 17 or early versions of Unity 2018. That's where it waas, but they've now moved this to the camera on this, a little link here. Look for the device tracker settings and if that gets removed in the future, you can also find that by going to the camera into the view for reconfiguration. Aunt, here's the device tracker Sony To take this box, put the tracking mode to positional on optimize for image targets. And what that does is it will make it so that when I've created the instance off the objects in the scene, the object will be created there. Now if the if I turn away with the camera, for example on my mobile, it will use a gyroscope in the device to maintain the world position off the object. So if I turn back, the car was still be exactly where we left it, which is fantastic. If you want to create larger scale augmented reality IQ in this particular case, I just want to do it so that I can demonstrate if you move around a little bit that the object will remain in the scene. Okay, so let's get an object. Then we're going to go to the asset store and I want to download one of thes models here off a Lamborghini. And there's a great little free Lamborghini in the asset store. Okay, What I want you to search for is sport Car three D on this model here. The orange Lamborghini is the one that we actually want. Now, if you haven't got this already, then scroll down and it will probably see download. But mine actually say's import because I've already downloaded the model. Now, here we go. Let's import the model if you don't know what this is. By the way, this is the Unity Asset Store where you can download anything from free models through two audio tracks are plug ins, OK, and then what this will do is down at the bottom. Once this is finished imported, it will create a folder for the assets down in the project. Down at the bottom. Here it is. Look, the sports car. So let's switch back to a scene for a second. And if I click on my image target, which is where I want the car to appear, if I open up the folder on Jump Through to the pre fabs. I confined the model, the temporary prefab that they created on Drop that onto the image tug onto the target. So it becomes unless that child, I'm just going to reset the position down to about 4.2 on set the scale to be naught point . Naught five. Because I happen to know that this is pretty large. There we go. I'm also going to rotate it minus 90. Okay, Cool. So now we have the three d model placed on top off our target back slightly on, based on the size off, the image that I'm using, which is a for the car, should appear in scale relative to the size of my paper. Now, just expand this and going to the body for a second, because that might as well change the color just here in the Inspector. And I'm just gonna make this kind of orangey color. There we go. Okay. Call. We've still got some time to kill. We've got about a minute left, so let's have a quick recap for a second. We've got an A R camera that is configured to use the background image with Mike Webcam over the top. We then have an image target that is configured to use our database of information and store the graphic off the Lamborghini. The image target has a child object, which is the car on top on. If everything runs according to plan, when I hold up the image, the A R camera should detect the graphic based on our database on superimpose our three D model on top with extended tracking on. So even if I move the target out of the camera, the car should remain in place. So moment of truth, guys. Let's give it a quick run. Here we go. Is to make sure have not done anything wrong. We're still about 30 seconds. Ok, then, here we go. Here's the image target. I'm fantastic, guys. There we go. Look, our first augmented reality experience. So it's placed the model relative to where I positioned on the side on the scene. Sorry. In relation to its size and everything else, and we still have a few seconds to go. Fantastic, guys. Well, well done. And congratulations on your first augmented reality experience. Okay, fantastic guys. So well, don't fantastic. I hope you enjoyed putting together your first augmented reality. Seen on Okay, a little bit over 10 minutes. If you include the opening of the software when everything else but fundamentally one show open running inside a project, you can create an A R camera, download the correct database on the information and configure of euphoria to run and create a new augmented reality experience, just like we just have. Okay. Fantastic. I'll see you in the next videos, guys. 4. Choosing The Right Bot: Okay, guys, welcome back and welcome to the new section. Now, in this section, we're going to be looking at the machine learning a I bought that I ended up using throughout projects. Now, to explain why I chose this particular bots over other ones, I want to explain a little bit of the background throughout the research and development process on Explain the path that I went down, which will hopefully preempt any questions that you may have. Now I know that I wanted to build a car showroom application and had seen a few on the market already that were actually used in commercial situations on and in order to maintain my course description to be accurate. One of the things I said was that I wanted to build on instruct people on how to build real world applications for real world use. Okay, so let's imagine that we've already got our application installed on a tablet or mobile phone device. The concept in my head at the time was to be able to open up the application, select a vehicle on then, without an image target being present, simply take X photograph off the surface in front of me and it would show me that car in an augmented reality experience. I'd then be able to zoom in and out, using my phone on the accelerometer on. I knew that I wanted to change the color of the vehicle in real time and maybe even open the open the bonnet open the car doors are start the engine, for example. Now there are many different ways that I could have done this, but it wouldn't have stood out from the crowd. We would have a virtual a our car in front of us. But what would have made this more unique is the fact that I wanted to do this with my voice. This is what I felt would be more valuable on a developers portfolio or, more impressive in a real world commercial situation for a company toe have as an application. So I then progress deeper inside the research and development area on, I started to set myself a few ground rules to make this happen. I wanted to create an application in unity which would use of euphoria, augmented reality software on be able to record my voice on automatically interact with the A R object to make a truly unique course. Andi application. So let's have a look at the ground rules that actually laid down. I wanted to remain true to the goal it was to create and control, and they are seen with voice commands. That was the unique selling point, and it still is now. In order to do that, I needed to be able to record my voice and convert most speech into text so that I could then call an action in a C sharp script, for example. So if I created an animation to open the door, then I would need to be able to call that function, which would play the animation at the correct time. I spoke on gave the command to do so, But how would I make unity? Understand what I wanted to say? And how would I make it convert speech into text? I started to look down the possible routes on what already existed as technology. The first area was obviously toe. Look at Google speech now Google Speech, a P I is what most android phones have honestly equivalent to say Syria on on an iPhone where you can simply press a button and say, Hey, Google or high Syria and then speak on the AI will convert your text your speech into text . I thought that that will be perfect. All I'd have to do convert the speech into text on then, as a result, off what would written us a text. I could then do a statement on say, if I've said this, call this function or if I say this call, this function on the job will be done. But then I proceeded in a little bit more depth and laid myself a few additional ground rules. They had to be accessible to everybody. It had to integrate with unity and it had to be free. Now I know that there are some really powerful machine learning platforms online, but the majority of them have a cost involved. Now that would be OK, provided that you've already got a client lined up and you knew that you were going to make a considerable return on your investment. However, in such a situation that we are right now, you're just simply learning how to do things, keeping the cost to a bare minimum or even free, which was the ideal was pretty much one of the vital components to my plan. The last thing Waas whether or not I needed an audio response. So at that time, if I said Show me the car in orange, for example, I didn't need the software to say Okay, I'll show you the car in orange I just simply wanted it to happen on perform the action. So with these ground will set, I then went off into the Internet and did a little bit of research and development. So let's have a look where we went. The first thing I did, of course, was have a look what was already out there. I jumped into Google when I did a quick car showing up and looked at the images on the one that I like the most, ironically, was at the top. This was from the Mercedes Benz company on their APS. Fantastic. This, I thought, would be a fantastic starting point as a loading screen where we could select different vehicles from a list the car could be rotating to give the scene a little bit of life on. Then, as we selected the car, it would then load my A R experience. The user would then be prompted to take a photograph off the surface in front of them so that the software would know where to place the vehicle on. They could then interact now moving down. The most common thing if we look at, say, the Mercedes are poor or a different up from from Chrysler, for example. They both follow the same rules. They have the vehicle in the center. They have a bunch of colors. Any normally click the buttons. Now. I thought this was good because people still like to have quick access, but I wanted to make it so that we could control this with our voice. Now the background would obviously be the real world in our situation, given a little bit more often impressive real world situation. So keeping the graphic user interface was something I wanted to maintain, although I wanted to keep it hidden off the sidebar and maybe hit a bottom to slide the menu in. Okay, so that out of the way, I had a plan off what I wanted the app to actually do. I'd also laid down a bunch of ground rules unless just week up for a second. I wanted to convert my speech into text. I wanted zero cost and it needed to be accessible so that the 1st 3 things that I wanted to have his rules. So here I am now inside the Google Cloud platform on the first area that I wanted to explore was if I could integrate the Google speech. AP I with unity. Now this can be done. I know it can be done. I've seen it done and I've done it myself a couple of times. But would it be suitable for this particular course? Now I know how good this is. If I simply press start and say hello, How are you today and stop? I knew it could on the fly comfort. Whatever I said into text on it's extremely accurate. Their machine learning behind this is fantastic. The only limitation. I came across wars on the pricing. Now, although it is free to use initially, it does have a cost involved. So if we come down to the priceless and go into the machine learning section, if I jump into the speech a p I, then I get 60 minutes for free on, then it starts to cost. Now you may think 60 minutes is a lot, but trust me throughout the development process. I it away quite a lot of minutes on, especially when you're stopped starting on. If you wanted to consider multiple users using the application this time period would soon be used up on, then a cost would be involved. So due to that fact, I had to eliminate the Google speech, a p I now. I also knew there was a way to use windows. Windows has an inbuilt speech. A. Well, not an A p I, but it hasn't in built speech. Dll It's shoes for the accessibility tools on. It's been around for quite a long time. The problem Waas because it was a Windows based AP, I it wasn't accessible to everybody. So because off the students that are on a mark on some of the students there on linen another, whatever other platform you want, then the course would have fallen at that point. So I couldn't use the Windows speech dll either. So I started to explore online on this, like me down into the machine learning area. I'm going to try and explain machine learning in an extremely simple way. Here we are with slide that I put together for you guys. Machine learning has been around for quite a while. Recently, we've seen a massive surge online on with viral videos off new AI bots on new cool little pieces of kit that use machine learning the concept beyond behind. It is basically to be able to ask a question to a machine. The machine will decide what the question means and act accordingly. Now, the whole basis off machine learning is based around the quality of data that the brain understands on the way that we've trained a machine to actually learn and understand. What we're talking about is by using something called the Reinforcement Learning Cycle. The concept is we ask a question on initially we teach the box what they expected. Answer is, the baht then learns this process. Is it using a complicated algorithm? The most common programming languages for such things are python and are now in this course . We don't cover the actual coding in python on our to do all these algorithms. However, we do handle the result off the machine learning bots on. Use that in cold inside a unity project, as that's all what we actually need it to do. So you don't have to worry about knowing how to code in Python on our at this point. Once the body has learned the decide response, we then proceed to aren't more data, so I would ask a similar question. So, for example, the first time I could say, What's the weather like in New York? I would then teach the baht that the word weather relates to the temperature on the current climate in a certain area of the world. On the word, New York was actually the place and location that I wanted to find out the weather about. So when I said What's the weather like in New York? Then it would know whether a New York are related to each other on. Therefore, it would learn and store that in explain. So when I come down and asked similar question and say, What's the weather like in London? The reinforcement learning cycle would say, Well, I know what weather means, but I don't know what the rest means. However, the structure of this sentence follows the exact same pattern as one I already understand. Well, you've asked for the weather in New York, so I can assume that London is the location that you actually want to learn about. And then, as I proceed to add more and more and more places than the system becomes more intelligent . And so he understands in other variations off the sentence that the word London or New York is an actual location in the real world. The next part off the reinforcement learning cycle is then to validate the correct response that the box suggests is a required action. So if I say what's the weather like in Tokyo, or what time is it in Tokyo, it will have a confidence rating that Tokyo is a place on. Once I validate that, that's a correct response. Or correct the baht. It will then proceed to run this back through the learning environment algorithm On learn the new correct response, the confidence level will increase and therefore the brain will become more intelligent. So it's a simple state off repeat and repeat on educating the baht. But it's on Leah's good as the data on you have to balance the data For example, if 80% of my questions are, what's the weather like in a different location? If I suddenly ask how many people live in New York, then the immediate response will be, Oh, I know what New York is, and it will proceed to give me either the weather or the time in that area. So in orderto get valid data on a reasonable, reliable output from the reinforcement learning cycle, I need to ensure that I asked a similar amount of questions for each different response. So if I wanted to ask 50 times what the weather was like in a different location in an ideal world, I would also ask what the time is in different locations about 50 times. So the balance between the bots brain are equal on one area doesn't away the other, ensuring that I get the correct action on response. And that's basically the foundation off machine learning very, very simplified in the description. But you going to the learning environment you trained the bots on it, comes back and says, OK, I now know what that means. So the following time you asked the question. It will then output a response and go back to the learning environment on this is the reinforcement learning cycle. So without bad in mind, I wanted to be able to create an app where I could ask pretty much whatever I wanted to do . Inside, the application on the boat will be smart enough to output the correct desired response with a fairly high confidence rating. So if I went again into Google, the different platforms very aim price on complexity. The first point of call waas one called Clara. If AI or clarify now, this AI learning bots platform is fantastic. It has a number of different, pretty defined databases where you can look unused image recognition in various categories , and it will be able to determine exactly what it's looking out and give you either information. Or it will give you a response to describe what exactly you want. If, for example, I wanted to hold up a different logo, it would know that this is a logo for Panera or Star Books, and it would suggest I look into Google and retrieve a load of information on Starbucks Open era on maybe even depending on the amount of foam or cream that's on the top. It could even distinguish between the different types of drinks. Now, this is fantastic. However, it falls onto areas for me. My current application doesn't need to use image recognition in this way. Now it will be useful to hold up the app in front of a vehicle on the software to be able to determine that it was a car. I maybe even the model that I was looking out on, then retrieve some specifications or information about the motor and the speed. But it wouldn't really give me out of the box when I was looking forward. Three. With regards to things like Open the door changed the color. So the second problem that I had with clarify if we look into the documentation was the well, the pricing for a start is acceptable. There is a free version on, although they do have a limitation off 5000 requests. I thought, Well, this is such a powerful system and opens up so many doors it may still be worth exploring, but it fell in the documentation for me. If I look at the quick start, we can see that the programming languages are on the right hand side. Now you can use JavaScript inside unity without any problems. However, work on to be using C sharp now. This wouldn't normally be a problem. But in this particular case for clarify, its based around a browser as Java, scripts on No Js are both browser and service side pieces of software. So I didn't really want to mess around with JavaScript in this particular case on, as the course isn't on actually educating in python or Java, then I didn't want to use those to programming languages either. The final option really was curled. Now Curl is a way to send a request through the Internet Andi query and online database or a P I to generate a response on This is fine. However, it didn't really involve what I wanted. So for those reasons, clarify was out of the window. 5. Choosing The Bot Continued: my search continued on, I decided to have a look at a more professional platform, which is Watson by IBM. Now I know IBM are fantastic, and I know that that machine learning platform Watson has have millions on millions invested in it. It's one of the best online machine learning platforms available to the public. Now, if you have a look at their free account on their terms and conditions, I found two limitations. The 1st 1 Waas. It's only available for 30 days on. This was a problem for me as I know that my students sometimes start, of course, and then the real world kicks in, and they may leave the course for a week or two or even longer before returning on. I didn't want their account free trial to expire before they could continue in the course. I also knew that they had an A P I in place that would integrate directly with unity, and I thought that was fantastic. But then I found another problem. With the license on the free version, you can only use one off their products or services on. Then you would have to upgrade to that plus account which is $30 a month. So going back to the original core plan, this could potentially isolate some of the students on. Therefore, he decided to move on once more. However, I do want to draw attention to Watson as being one of the best ai machine learning platforms on. It's so good. I'm actually considering doing an additional course on Unity on Watson to do an alternate up. So moving on, where did I end up? I ended up with wit a I on Although it doesn't have the Brandon off a company such as IBM behind it, it is massively popular online for developers. It's the core brain to the majority off the Facebook bots that people are coming across on . It has a massive following on an online community on the popular website gets where people will actually share their cold for free on. You can use it to create various applications, so I need to figure out how to use wit to see how suitable it waas. So my next step was to find out the price it was to find out how powerful the system waas on. If he could handle speech to text recognition and the good news guys, it's completely free. It's completely free. It comes in over 70 languages on, and the only limitations that they have is that you don't query their system more than one time per second. Perfect. We hit the jackpot, but I wanted to try it out and make sure that the machine learning platform was up to the job. And I'm happy to report that Wit ai is amazing. Now, to use this on to train this system inside our little environment off the reinforcement learning cycle, we're going to need to train the bots, validate the responses on, then ask additional questions over and over again. Now, inside their accounts, there were two ways to do this. They have an online platform. Andi, you can also use something called a curl command. Now, if I just jump back to the home page for a second, the way that you log into, which is AI is either with a gets Hope account or with a Facebook account for the research area I actually loved in using my Facebook account. So that's what I'm going to do now. Here are a few off the demonstration APS that I have. And if I just jump into the car, they are application. I'll give you a quick overview on how this actually works down. Here is where you pass the questions. The system will then predict the required desired response that you want. For example, Show me the car in orange on. You can see that the machine learning platform has Bean trained already that it knows that I want to change the color on the selective color that I want is orange. And I'm going to show you exactly how to do this. I'm going to start completely from scratch with a brand new. But before we do that, you need one thing. As I mentioned, part of the learning cycle is to validate the response which I can do here like so. However, throughout the development process, we will be sending multiple requests system on. They will appear over here inside the inbox, and this is where the majority of our validation will occur on throughout the reinforcement learning cycle. In order to simulate this, we're going to be sending a curl command to the Wit ai website directly from our computers before we even go into unity so that our data is already understandable on. We can use it effectively in our scene on the way that we do. This is by on a Mac using the terminal. Now, don't worry. The cold will be copied and pasted from the wit a AI website directly. However, for the Windows users, you only to download one additional piece of kit. If your own windows, I want you to jump in to do go on type in git bash, Okay, And then what I want you to do is come down and click on the download package for windows, so just click the link that on it will download automatically. Now, if you've under on the home page for whatever reason, then the website will automatically detect the version off your computer on should switch this to be windows rather than mark. Or if it doesn't for whatever reason, go into the downloads and select the correct version for your operating system. Now, once you have git bash installed, we're ready to rock and roll. So what I don't need to do next head across toe wit ai. I'm going to log out so we start exactly at the same place on when you're ready to proceed , We're going to log in together and creates are fantastic first machine learning bots. I'll see you in the next video, guys. 6. Your First AI Bot: Hi, guys. Welcome back. So it's time to start putting together our first A I bought for the app. Okay, so the first up is the car showroom up where you will be able to see and visualize an augmented reality vehicle in front of you on. Then, using voice commands, we want to be able to alter the augmented reality scene. So what I've done is I've prepared a little list. So if I just say bye for a second, I minimize my camera. I can jump across to my notes. OK, so these are the different actions that I want to actually be able to perform. I want to be able to open and close, start and stop on change the color off various items. I've also put together a mini little unity demo scene. So if I just jump across to unity, here is a vehicle that we're going to use. It's a Ford sedan, I think, Andi, it's a free model that you can download from the assets start, which I'll show you how to do in the next video. Okay, so what I've done is I've automatically added an anime to control the to this Andi. I've hooked it up with a few animations. I don't worry if you knew, I'm going to show you how to do everything step by step. But ultimately, this is a car that I've just raked up on. I want to show you what it will do. So what I've done is I've added an animator and I've created a bunch of animations on Triggers on then here it is I dealing away not doing anything much at the moment. But when we say open the door, for example, what's going to happen is unity will record my voice. It's then going to send the Web file the audio file across to the wit ai. I then want the A I bought to understand what I'm asking on. It will take the word open on. It will take a part of the car, the door, and it will put the two together and send some information back to unity. So in the cold, we will be able to receive the message from the wit ai that say's you want to open the door . Okay, so then we will call a function that will trigger this here on the car door will open. We then want to be able to say close the door. The same will happen, Andi. It will call the function to close the door. I've also rated up so that we can say open the bonnets or the hood in in American English, so that will show the engine like so on. Then you'll be able to move around using the camera on looking side, the engine or things like that. You'll then be able to say close the engine on that will close the bonnet or hood Onda do things like open the windows like so Aunt, close the windows like so So all these little mini animations are all custom built. I've just rigged it up myself. It takes about 10 15 minutes, so don't worry. We can do whatever you want on def. You want to You can also rig it up a little bit more where you can rotate the wheels if you want and the lights on. You can really go to town on this. Guys, I'm just gonna give you the foundation. I'm a little bit more on. Then you can build on that platform and do whatever you want I'm also going to make it so we can say change. The color on that will do things like this. If I click on the body of the car for a second, we will dynamically using code change the color on the shader for the body off the car. So if we say show me the car in blue, for example, it will switch the car color to blue or show me the car in green Well, black or whatever you want and it will dynamically on the fly. Switch it. You can also do multiple things I could say Show me the engine on. I could also say change the color to red are red, not orange. So it could change the color to red and it would remain the same. Look and everything switches on works fantastically well. So the idea is that this will be the actual scene we will build. Afterwards, we were built an intro scene which will basically be the launch screen off the app. So you will open the app on the mobile phone and you will have a list of different vehicles . We're going to select this vehicle on, then take a photograph off the area, the surface in front of us where we want to actually project the vehicle on. Then we're going to be able to use voice controls to query the wit AI bought on. Hopefully, it will be smart enough to send us back the correct information on. We will be able to interact and control. The scene will even be able to start The engine generates some smoke coming out of the exhaust. How cool that be. Okay, so quick, jump back to the notes again. Here we go. We're going to open the driver's door. The bonnet or the hood, the boot or trunk on the windows were then going to close all of that. And we're also going to be able to start the engine video for the actual car or a car on. We're going to be able to rotate the vehicle as well. So when I say start rotation, what's going to happen is we're going to activate a loop which will make the car rotate dynamically in front of us in the real world. So that's gonna be really cool on. We're going to also be able to say stop rotation on that will stop the rotation on these air. The default colors that I'm adding in on then using the cold will be able to manipulate the actual shader. But the idea is to keep things simple. These initial actions here are not very complex, and they're easily categorized. So by all means you can add additional parts off the car on the lights and things like that . But these actions here are what we're going to be known from now as the trays. So the trays are the actions that were actually wanting toe happen. And that's how wit AI works. It works with traits, so we're going to create a custom trait, which is open and close for the first section. Then we're going to add different parameters, like the driver's door, the booth windows and things like that, and we're going to train our little A. I bought until it understands what we want. Now there's a slight delay on this while it has to process and run it through the algorithm , but within about 10 15 minutes, the boat will be smart enough to start generating some results. Okay, so with that said, let's jump right into it. I'll just come out of play mode for a second so that I have a little bit more power on the computer. Um, minimize unity on here. We are at wits A I So I have got a Facebook account as a log in, for which they I you can have your facebook account or you can log in with get up. If you don't have an account for either, just jump across to their websites on Sign up on then. Here we go. We can answer in. So we're faced initially with the wit ai dashboard. Now it looks a little bit crazy at first where you may feel a little bit lost. You don't really know what you're looking at, but in a nutshell, we've got a bunch of ups. You guys will probably have nothing or even have an image in the middle saying create your first application. But for me, I've got the little list here and I have this little plus icon up in the corner, which is where you aren't a new app. So I'm going to add my new app on my app is going to be called demo unity. Okay, so description Car demo up engine for the U Demi course like So now you guys can choose whatever language you want. It's smart enough to understand on as mentioned, there's over 70 languages in here, so hopefully your language is covered so you don't have to work in English. I'm going to, but you don't have to, guys. The next two options we have is open or private with regards to the data. Now it's a I is completely free to use. However, lots of people share their information and share their little machine learning bots, So it's a great way if you want to collaborate with different people. I'm going to leave miners open because there's nothing confidential, really, in my in my coat on and you never know. Some somebody may use this in the future. Now, once I've completed this thesis project in the course, what I'm going to do is actually export my completed engine as an app on it will be attached to this video. So up in the corner over here, you'll probably have the resource is blue button on if you want to, you can simply import my completed, but I'm going to upload my baht as a resource here. So you don't have to do this if you don't need to, you can simply import mine on the way to do that will be to download the the file that's attached, save it to the desktop. Oh, everyone. And then you would use this browse button and you be able to import the data from my from my wit ai bought. But I like building these things. So let's create the first up. Here we go. So we are in now. We have a bunch off tabs up here. Understanding is the learning environment. Okay, so this tub here is what we're seeing right now. Here is where we write our questions on then. Here is where we are, an entity which are basically the actions. Now they're categorized into different things. An intent is what we're going to be working with and their the intentions, the actions of what we want. So, for example, open or close or dance or play would be an actual intent in the system, and we're going to use user defined intentions. So we're going to create our own, which is open and close and rotate and well rotates, actually parameter. But you see where I'm going with the idea, guys. Now these other categories. At the moment, we're not really going to be using these. They're more apt, relevant and specific to different types. If you were making, for example, an app that needed to know the age of a person, you would use this as a category. Or maybe you want to have the greeting. So if you said hello, a car demo app, then it would understand Hello as a greeting as lots of basic greetings like hello and goodbye and things like that. They're already pre loaded into the Wit AI database. So the learning curve is a lot faster, so you can categorize different things. If you wanted to say, What time is it in New York, for example, then it could return that you need to do a local search query. So that's what all these different categories of far all the time you'll become more and more used to this and more familiar. And for different applications, different different traits will be more suitable. But for us for now, or any to do is create an intention on We're going to start in this understanding tab on teaching our app what you want to actually do As these additional tiles become relevant, I'll explain exactly what we need to do and what therefore, But for now, here we go. So the first thing I need to train my up to do is to understand the word open. The first thing I want to open is the driver's door. So I'm gonna come down here on right. The word open will write a sentence, actually, driver's door. Okay, Now I'm going to create a user defined intention on. I'm going to call this open pressure return twice. So 12 on that will confirm this on. Then it asks for a value. So if I highlight driver's door, there we go. It will create a new value as driver's door, and I just click now Open drivers Door has the action, which is what it will return through to unity, saying, You said the word open. So you need to open something on. Then I'm at in an additional parameter, which is the driver's door. So then I validate this response on the wit. Ai little brain gives you a wave on, it starts to learn. So let's add another sentence. Open the driver's door, please on Look already it suggested open, and it's asking what you want to actually open. Oh, I spelled drivers room one second. I don't to training battle driver's door. Make sure you spell it right, guys. Otherwise we're going tohave Bad data straight away, so it knows that we want to open something on. I'm going to highlight driver's door again. Andi. Now I'm going to take driver's door. I'm ignoring the word please, like so on. Validate the response. So let's add another way of askin. Could you open the driver's door, please look straight away. Open highlight driver's door Selected from the list. I don't need the additional text on keeping it nice and clean. The data that we go on it will exclude the additional information. Validate the response. I don't we just need to keep repeating this, But remember what I said about the balance. If accidentally say close the driver's door, watch what happens. Who, if I click on the box, close the driver's door. Look, it doesn't understand what what close means, so it's automatically assuming I know what a driver's door is. I'm guessing you want to open it on. It is 90% while 0.9% so 90% accurate are confident. Sorry that that's exactly what you want. But how could it not know if you imagine our little wit AI bought is just an infant or we've done ist teach the infant how to say, Mom, our dad, it doesn't know any other words are any of the vocabulary. So what I'm going to do is I'm going to click the little X and say, Actually, your incorrect. I'm going to highlight the word close on, going to create an entity for the word close. Like so in upper case, which it won't let me do for some reason. There we go. Press return twice on. Now we have close. So if a highlight driver's door then I can select from the list type in drivers door like so on. Now this new trait this new action, which is close, has a value off driver's door. So let's validate that. So now if I say, could you close the driver's door, please? Look, now it's debating what to do it, saying, I'm 100% confident that you want to me to open because we've asked probably what six or seven phrases on nine out? Well, by whatever. 90% of those have bean to open. So I'm pretty sure you want me to open. But I'm actually also considering this new action, which is to close. So let's just remove open once more, leaving as close on. Look the driver's door, sir. So let's validate this response, and this is how we balance our data now. As this happens down at the bottom, it says that our up uses three different intentions. The 1st 1 is an intent, which is a general action on. Then these are the user defined ones open and close. Now, if I click on open, you can see the phrases that I've talked in. Could you open the driver's door? Please open drivers door, please open drivers door. So let's go back and click on close. I look. Could you close the driver's door? Please close the driver's door. What was the one was missing? Just go back one more time, are closed. Driver's door, please. So now if I go back, I'm going to say closed Driver's close. The driver's door, please, that we go and now get rid of open highlights. Close. I grab hold of that on, and yet that's okay. Let's validate it. So now the confidence level whenever the word close is present in the sentence, will increase in comparison to over. Open on. That's how we're going to balance our data. Just think that it's an infant or even a pet, like a dog or a cat. He only knows a handful of words at this point. Over time you can add on, add it. Add hundreds of expressions on wit. Ai actually recommend that you ask in 100 different ways for the Bach to fully understand exactly what you mean. I don't worry about that. In my experience. After about 10 or 15 phrases nine times out of 10 it nails it and gets it completely right Book. All we've been asking for at the moment is a driver's door. Let's jump in and have a look. What's next? So let's open the bonnet on, then will open the hood. So I could you open the bombings, please. Now watch what happens here. It's saying open on because the pattern off the sentence matches opening the driver's door , it's automatically assumed that the bonnet please, is the thing that we're referring to. But all I want to do is grab a hold off the bonnet or even bonnet on its own. Andi, I'm going to create a new trait for Bonnet. I'm pressure return. So now open will have to. It will have the driver's door and it will have bonnet on. Let's validate that response. So now to keep things balanced, let's ask if it could you close the bonnet, please. Look, now it's asking. I'm pretty sure you want me to open the bonnet because I only have one sentence in my entire brain that matches the word bonnet, and that was when you wanted to open it. But how? We're going to balance the data. I'm a great to grab on it. Found at Bonnets again. Here 7. Creating The Car Bot: now it didn't appear in the list, and that's because it's updating the brain at the same time. In about 15 minutes. Suddenly Bonnet will start to appear in the list. It's actually working in real time now and in the background. It's running it through. Really complex pythons are different, cold and running through algorithms on processing the data. But from our point of view is nice and easy. Guys, all we have to do is keep it simple. So a trick is to play kiss now What? What I mean by that is I used to have a teacher on when we used to play, play football or soccer if you're in the US When I was a kid, our teacher used to say, Kiss it. The same can be applied to this kind of work. So if you look at the word kiss now, what he meant waas this. I just made this a little bit bigger so you guys can see it. Here we go, his phrase Waas Keep it simple, son. Meaning the boy the guy. Okay, so remember to kiss the app, so keep it simple in the foundation. It can't handle all these complex phrases in different ways. Try to keep it simple. Keep the same kind of pattern. I'm just very one or two other words. So could you open the bonnet? Can you open the bonnet? Please open the bonnet. But the structure of the sentence remains the same. As time goes on, you can ask you various different ways. Why No, open the bonnet or what would happen if you open the bombing on, then the algorithm will be smart enough. But we're just working right in the infancy right now, guys. So kiss it. Kiss the app and keep it simple. Okay, so the next thing that we want to do, we've got opening and closing the door on the bonnet. So let's let's work on the foot. So could you open the hood? Okay. And now look, open the hood, but I only want the word hood. So I'm going to create a new parameter just for Hood Onda. Validate. Now let's say, could you close the hood? Here we go, Andi, look, it's asking again. It's got the word hood, but it's only popped up in the open because that's the only phrase signals wet, which includes the word hood. But I'm going to teach you a new one, which is too close. And if I grabbed the hood and then write the word hood in that will now be associate it with clothes as well. So let's see what happens if I say open the hood. Now, look it Know straightaway. Open the hood on its dealer 0.95 between 01 at confident. So now let's say close the hood on. Watch what happens. Close the hood cloak cause a bonnet. Close a hard. Let's switch this to the hood. Let's eliminate that. And now the data is balanced again. Okay, so let's do one more wrote. Move up. Sorry, Windows. Let's do the windows. So, uh, open the windows. Okay. Open our new value with the windows. No, I just want the word windows. So that's our windows in here. There we go. On Validate response. Who could not validate this expression? One second, maybe down to my Internet connection doesn't like that one. Okay, We'll try refreshing the page for a second. Here we go. Could you open the windows? Here we go. Open windows. Validate. There we go. So could you close the windows. There we go. Open windows. No, that's the only phrase it knows with the word windows. What we want to do is close. Be windows. Pressure turn. Validate the response on. There we go, guy. So now we're opening and closing three different parts of the car. Now, because we've kept the structure similar. Where is an action such as open or close on the values as parts? That means that the responses from which a I will be similar it will have. What it actually does is output outputs and cold. That's called Jason, which is our Jason, which is a javascript orientated array. Basically, it's a JavaScript list in the structure off a tree, which will see in a second. But what I'm doing is I'm playing Kiss. I'm keeping it simple. I'm having one trait and won't value. Okay, so I'm not going into the age of a person because that will alter the Java script that comes out at the other end on Say's You're actually looking for this type of trait, which is related to something else on. This is a value on the JavaScript, very, quite a lot between the different responses that we will be receiving from the Wit AI platform, which makes the handling off the data inside unity a little bit harder. So, Keith, kiss it. Keep it simple. Let's do one last one are we can close that one. So the boots or the trunk? Okay, let's do it. So, uh, open the trunk, please. Here we go. Open that drunk plays. No, just trunk. Let's create a new word for trunk. There we go. Validates. Could you open the trunk, please? On. There we go. Look, it's smart enough now it's It's It's thinking for itself. It knows I want to open the trunk. Um, please open the trunk. Open the trunk one second. I just want to open trunk, not the trunk. Otherwise, that data will be clean. It will give us both responses, which will alter the output. So remember, just to have the actual item that we want to interact with in the response. So now let's close the trunk. Close the trunk so it will recognize a word close. And he also recognizes open Andi because it has some knowledge already of the trunk once more, it appears, but we don't want to do that. We want to train it on associate drunk to the clothes for the first time. So there we go high like this at this on Valley Gate. Okay, let's do. Could you close the trunk? Here we go. Get rid of open. Close the trunk. Highlight the word trunk on. Validate. There we go. So let's think of an alternative way of asking this. Show me inside the trunk. A spell. The word inside the trunk on. Now look, even though the word open isn't there, because the brain only understands open and close, it's having a guess. Open because Open has the most phrases already in the brain in comparison to close. But it's got it right, so it's validated. Show me inside the trunk. Show me inside the engine, for example. Okay, so let's open. I like the word engine. Let's make a new word engine. There we go. So show me inside. The engine will actually opened the trunk or open the engine. Let's let's open the hood. That's probably better. We do need the word engine for later on when we start and stop the engine. So what matters will leave that in there, So show me inside. The engine means open the hood. So if I write it again, show me inside the bonnet open bonnet and choose bonnet from the list. So now we can say in both ways, So open, Close. Show me inside. Could you open the trunk? Could you close the trunk? Could you open the bonnet on? It's starting to work now. This little green light appear is the training status. So sometimes you'll have a few dots going across on. That's why it's just processing your requests once you have a bunch like we've just been playing around with now in a couple of minutes inside the inbox. This is where the actual phrases that we're trying out on what we're teaching the brain to do will appear in the list on. Then we'll have to validate in this area, but this normally works with the A p I. So let's have a quick look at that. Now let's jump across to the settings tab. Okay, Now the settings tab is the area where we can practice for the kill command. Now, this here is my unique cold. Now I don't mind showing you guys on here anyway, as this is just a demo up. But that is the confidential side that you want to keep private just to you yourself. As anyone with that cold can access your data base whether it's private or no, it will authenticate, and they will have access to this. So if you want to create another video to shore friend or whatever, make sure that this part is blood out of the minute. Otherwise, the people will be able to access your data. It doesn't really matter for me because I'm making the data public anyway. Eso and this part down at the bottom is just the version off the engine off the brain for wit ai on its using the year month on date, which is the most up to date version. So this is a structure off a kill command where it will send header information, which is information for the browser over the top. And it will send a parameter like a user name or password on that. What the 1st 1 will be authentication on the bearer is a sender on. This is my I d. So what we're doing here is we're opening a kill command. So it opens up an Internet connection, and it sends this information across to the browser it's sending through my authentication toe. Allow me access to this database. This is a website address that is sending the type is a message meaning written text. Later on, this will be speech as it will be an audio file. The version off the brain is the date on the Q equals means the query that we won't answer to. So up here if I type in, show me, uh, fact, open the hood nice and easy. It will dynamically right in my query now to structure the sentence to be fit to send across toe a browser every time you have a space written up in the u. R L bar up at the top, it's converted into the percent 20 character trait. So that's what that's actually doing. Now if I copy this over here like so that has now copied this cold to my clipboard, and this is all we need to paste into our terminal if you're on a Mac or or Lennox or into git bash. If you're on Windows now, make sure you're on the correct up, which you probably will be as you've only got one. The time zone for now for testing doesn't really matter. But you can change it wherever you want on the language. Make sure you're asking in the correct language on then all we have to do is come down. And I'm just going to open up my terminal by pressing command and space to open the spotlight on type inning terminal. Here we go is a terminal up on. Then watch what happens here. Here is a terminal up. I'm just simply going to paste this code in Andi from my computer. It will jump through to this website address authenticating who I am with my authorization bear I D. And he will ask the query, Open the hood to this application. So when I press return, let's see what the boat returns. Here we go. So the box has successfully returned something. Now, if I just copy this for a second like so I'll make it a little bit easier for you guys to read. If I just go to an online Jason view it is. This is a programming language that is used and I paste this in here and then click on viewer. Here we go look so like I said, it's a tree structure as it returns information and I can expand the's different columns. It's saying that the text of century was open the hood on. Then the entity, which is basically the actions that were requested, is to open on the value waas the hood on it, 0.98% confident. So it's remember the value of confidences from 0 to 1. So that means it's 98% confident that that's exactly what I wanted it to do. So already it's understanding what we want to do. So here we go is try another one. Could you open the windows? So a little bit of a variation on what we've bean asking. Copy this. Go to my term. You know, I'm just going to tap the word clear and pressure turn just a white this on, Then paste in the new command pressure it's and on. Let's see what the Bach comes up with. If I grab the message again from here, jump across to the Jason viewer. I'm paste over this. Go to the viewer on now look When I expand the tree, he is the information that's come back. Could you open the windows? It's decided 98% confident that it wants to open the windows. And that's working perfectly fine. This is exactly what we need. Now, when this information is pulled into unity, we can call a function Jump across on. What will happen when we received that command is that I'm going to set a trigger on the animator to do exactly this. Fantastic guys. Okay, so now it's over to you. It's hands on time. Guys. I want you to come across to your up, Jim, back to the understanding tab on. I want you to teach your app, maintaining the same structure like so a few more alternate variations on get the baht to understand remembering to balance the responses between opening and closing on. If you want to look how many times you've asked one of the specific Fraser's click on the entity and you can see all the phrases that have bean us down here Now we did hit the A P I from the terminal command. So now if I go back to the inbox and refresh, hopefully Maybe it's not hard enough time yet. No, not yet. But kiss it. Keep it simple. Some keep it simple. Remember, just one word. Open or close on. Only highlight the actual part of the car that you want to interact with. So now it's hands on time. Let's make your bots smarter. Give it a few different variations. Try to be creative. Try to think. What will the people may ask? How they may ask the question on Really start giving your brain a little bit of pro processing power. Okay, so that's it for this video. There's obviously a lot more to wit AI, which we're going to. You'll be introduced to it as time progresses, so that you can process everything and really absorb all the functionality in the commands that we need to be using later on. But for now, this is all we need to do. Guys, what we're going to do next in the video is actually start building the car up on Look at how we can send received simple messages like this before we move on to voice to get the actions working. Okay, Fantastic. Have fun. Have a bit of a play with your a your cool little machine learning ai on. I'll see you in the next video 8. What Are We Making?: in this section, you're going to learn how to build your first commercial application, the A R car performance. Up. We start by creating exactly what you're seeing right now, including importing three D models, animation, sliding animation menus, particle systems on the script control the entire scene. There's a lot to get through guys, so let's get going. 9. Project One Intro: Okay, then. Guys, here we go. This is Project One. I want you to open up unity on Click the new button up in the corner to open up a new project. I'm going to name mine A our car performance. There we go. You can call yours whatever you want. Just make sure that you're in the three D environment and click create project. Now, the first thing that we're going to do is we're going to switch platform. Now is always easier to do this when the project's empty, as he doesn't have to convert any file. And we don't have to wait for any compilation issues. So the first thing I want you to do is jump up into file, build settings and choose which have a platform you want. I'm personally going to choose Android as I find the development process a little bit quicker due to the fact that I don't have to export into x cold every time I want to test the project. So once you selected, which have a platform you want, just click switch platform. There we go. Nice and quick. The next thing is to add the open seen on The first scene that we're going to do is the intro scene. It's a scene that you will first see when you run the out so that we go now. I want you to just simply close this for a second. We're going back there in a minute, but I want you to come down to the asset panel down at the bottom. There's a bunch of resource is for you guys to download to pause the video now and then. We can now continue, so I have mine extracted on the desktop. It's a pack of cars, plus a few extra little bonus items that have thrown in for you guys. I just want you to simply Dragon. Drop that into the project panel at the bottom. Now, inside this park, there are a bunch of cars that I've customized. Andi tried to make them look as good as possible, basically, but what I've done is I've included all the materials used. I've also included a custom font on a few extra peripherals, such as alternate wheels if you wanted to swap any of the wheels out on any of the vehicles . So the reason I've left all the textures in it so that you guys can mix and match and try to customize and Taylor everything. I've also included a photo shop file, which is for the icon for the mobile phone, so that it looks and has a professional polished edge. So there's a PSD Photoshopped file. If you want to open that in photo shop. Oh, whatever else can open Photoshopped files, I have also included the exported PNG file that we can use on we're going to use right now . So the next thing I want you to do back into the build settings, and this time I want you to come across to the players settings on Give your up a name, so I'm going to call mine a car. Then where it says, Default icon, I want you to click Select And here look up at the top is the icon that I created, so you can just double click. The application is going to be using of euphoria, so we need to click view four year augmented reality on. Then I want you to go to the resolution and presentation as it's going to be a landscape only application, and I'm going to use landscape left. I think it's left anyway. It depends on which way the view Fauria Target is actually facing. So we may have to switch this later on. Okay, One final thing going to other settings. Unchanged the package name here to have your company name. I'm just going to use my initials DMH on then the product name, which is, in my case, a Our car Might as well keep this lower case as well, just in case it starts to sulk at any point. Then if we come down with just double check everything I want to make sure android TV compatibility is turned off. Andi, I'm going to change mind to have kick up as a minimum just to make sure as we're messing with a r and a bunch of models, I want the mobile device as a bare minimum toe. Have enough power. So it needs to be a more recent phone. Nothing spectacular. Nothing brand new, but something about 4.4 or easily undo what we're trying to do. Euphoria has capabilities to actually run on. I think it's 4.2 or even 4.1. Okay, so I think that is the XML money fast. All set up. We're on the right platform. We've ticked augmented reality down at the bottom. Yep, We're ready to go. Okay. So quick. Problem with of euphoria on an easy fix. Want to click on the camera for a second and pay attention down at the bottom? Here on the inspector, we have audio listener as the last item boat because we take X are settings for euphoria. When you press play, unity now will automatically turn on the camera. Here we go on. We don't have that. So the intro scene doesn't need to be an augmented reality scene. It's a very quick fix. I just want to click the camera down to the component here on I want to start searching for of euphoria behavior, so v u f There it is. This is a file that gets attached automatically to the camera whenever the X are setting the ticked. So normally, when we have an A R camera imported from up here like so that camera will automatically have this script attached. So what we're going to do is kind of trick unity into thinking that this is an A R camera, but we want to disable it on now when we press play or we can see is an empty seen perfect . Okay, guys. So let's have a look at the goodie pack that I put together for you Inside the folder for Cars Pack. There's an extra pack of cars here. I have a convertible Lamborghini, some environmental access, the PNG icon logo, a Photoshopped version off. This in case you want to open it up and change it. A few extras. Such a spare wheels if you want to swap them on a vehicle. The orange Lamborghini on the toe CAS are both from the assets store. That's the one that we downloaded initially for the 10 minute challenge on the Tokars is basically a Ford Focus that someone's uploaded. The last one is a Porsche 9 11 which has the vinyl wrap off a police car. So I thought, Well, throw it in as a bonus for you guys. Some of you may want to use it, or they may want to use their own cars. It's completely up to you. I then included a mini script on all this does whatever objects it's attached to is rotate the object on the Y axis. And then finally, I've included a font which we're going to use to make the make the scene look a little bit better. Now, I didn't choose the name guys, That is the name of the funds. So the Ravens in your pants, it is what it is. The most important thing to me isn't the name. It's how it looks. And I think it looks pretty cool. Okay, so what do we want to do? Well, the first thing we want to do is create this kind of environment where we've got a car on a panel and then the panel is rotating and then we have a background of a three D cube. So I've put together a little goody park for you, and I've saved is a prefab. So inside the environment folder, here is what I've called the carriage, and I want you to click and drag that up onto the hierarchy. That would go and then just double click it in the hierarchy. Just move my unity across a little bit. There we go. Okay. Let's bring the camera down and see what I've actually prepared for you guys. Now what I've done is I've used four different cubes, so each individual item is a cube which can see in the hierarchy. All I've done is I've scaled the cube down on the X and the Y axis to make it look like a set of walls and then have strategically positioned them on top of another flat cube, which I'm using This the floor, I presume in. I've also included a model off the convertible Lamborghini on. Then I've additionally added a platform here. Now the platform is in the hierarchy here, and if you expand it, you can see the different items inside. You can see that the Lamborghini is actually a child item off. This black panel here on top of that black panel is on the top and then underneath it, we have the turquoise plates around the edge and we have a lighter panel in between. Now, if you want to change the colors of any of thes, just simply select whichever one you want and then come across to the inspector on underneath the mesh rendering. You can see the shade of that supplied, which is basically the effect. So you click the arrow to expand. If you want to change this color, all you have to do is click here. You can change it. It's whatever color you were like, So just do that for a second. So what I did was I put these three plates together, and then I put them inside an empty game object. I then attached a script to that empty game object, which is the rotation script on the Y axis. Look, this arrow here, Well, straight from top to bottom. So what I've done is I've told it to rotate on this axis here so that it will give the effect that the plate is actually turning on because the car is a child off the black plate . That, too, will also change. Okay, so just zoom out for a second because I want to show you one more thing. As I mentioned, these are individual cubes now. They all have their own little mesh renderers on themselves as a component. If you don't like the look or the color of any of this, when I've done inside the cars pack here inside any of thes cars, I've included all the materials that The whole heap of resource is for you guys. So if you look inside the convertible tab, here are all the different materials that are used for the car such as the lights, chrome effect. Zoom down to the kike and just see how how call this actual model is You look, check this out. Guys, look at this. This is fantastic. So the floor is a different material. Andi, the body has a different material applied. The windows have a different material applied and all of those air inside here and then all I've done is play around a little bit with the effect. For example, if I click on the glass, you click once and it will select the carriage click again and it will select the individual item. So it's jumped inside my Lamborghini. Look down to the windshield. Now the glass here. All I've done is instead of it being standard. I changed it to standard roughness. And then, instead of the rendering, moot being opaque like so I made it transparent. I then came down to the color and I pulled the outfit down look so I can increase or decrease the Alfa and that's how you give the impression off transparent windows. Now, if you don't like any of these colors like a said, all the materials are here. All you have to do is drag and drop them onto whatever I to me one. So, for example, if you want to change the color of the car or we have to do is either select the item and swap the color or selecting alternate models material on, then just simply dragon, drop it onto the different parts of the car. Look like so on. Now we've got a red Lamborghini. Now what you'll notice is that it doesn't have that shiny look and feel to it. I'll show you where that comes from. If I just do this for a second that we go. If I select any of these ones like so I can come down to the Lamborghini Shada here that's applied for the color for the blue. Now what I've done here is this one here this parameter I increased the metallic look. So if I pull up down, there we go. It looks more Matt like the red did. However, if I pull it back up and it gives it a metallic look, Don't it to be too over the top. So somewhere in the middle looks good. The roughness is basically the reflective light. So have a play with this and get it looking exactly how you want your cars to look. Okay, so the same applies for the actual environment that I've created. If I want the background to look different, all I have to do is choose whichever material I want from which have a car and then simply drag and drop whichever material you want on to whichever surface you want. And it will change the look off the actual environment look like so. And now if I go to the I for come down to the car, you can see how that has changed the field. I'm just going to undo this as I really liked it as it was before. Like so. Okay, so the next thing I want to do is line the camera up. I want you to scroll around and get the camera to kind of look somewhere in the middle. We're going to make it more accurate in the game view in a second. But I want to be able to see the panel. Here we go. So to balance thes sides like so that's the camera kind of lined up with a background. We're going to move the panel afterwards, so don't worry about that. On what I want is enough room for the panel to rotate. And I want enough room at the top for the title, off the app and some buttons on the left and the right off the scene. So what I want you to do now is come up to the main camera and you can see that the preview here that companies were over here to the right what I want you to do while a Camry selected is click on game objects and click Align with View and that will copy the location of my current view. Andi, replace the parameters and the values off the main camera like so there we go. Look. So now when we press play, the camera will see this view. And as mentioned, my game object here has the rotation script attached. The Y axis is there. Let me just open this up and give you guys a quick look. So here we are, a model developed. All I've done is create a private float with a speed of 25. I'm just going to lower that down a bit to 5 25 was throughout my testing earlier on on then on the update statement. All I've done is said Grab Ahold off the transform, which is this component here on which ever game object this script is attached to, and I want you to rotate on the X y and Zed access, which are these three x y and zed? Well, actually, these three here on, I don't want it to change on the X, and I don't want it to change on the said. I just wanted to rotate on the why. So what I've done is I've said every second, which is time dots Delta turn. I want you to move it five across, and then what will happen because it's on the update statement is This will repeatedly rotate and that's attached to the game object where all my different items are inside, so that in theory, as all these items are, Children will rotate everything. So let's just press play and have a quick look at what effect looks like now we go look. So if you want to speed up the rotation or slow down the rotation, just simply change that private float variable on the script. Andi, that's how we put together this little scene. If you want to customize it some more, you can change the model if you want, or you can change the colors off any of the items here. It's completely up to you guys, but I like it out. How it iss Okay, so the first thing we need to do is make it so that when we're looking at this view in the game view, it looks like a real professional up. Now the first thing I want to do is line up the platform. So while I'm in the game view, I'm not in play mode. I'm just in the game view. I want you to click here. I make sure you're at the right resolution. Now. I'm using the iPhone six in Landscape, which is 1334 by 7 50 I find iPhone. Six is a good middle ground for all mobile devices. So if you don't have this here, what I want you to do is click the little plus icon, and I want you to add the iPhone six on then in the X and the Y, I want you to put the 1334 by 7 50 into these values and click OK. That way our canvas can automatically scale all the items on. It will prevent any issues. When people have this on their mobile device or tablet. That's a different saris. If we give the screen of reference resolution off, say, an iPhone six, it's very easy for the software to automatically scale all the items on a make the buttons smaller or bigger, depending on the device screen size. Okay, so that out of the way for a second, let's sort out this platform. So it's looking in the middle. It looks like these edges are a little bit off. So I want to click on the camera, and I'm just going to rotate on the Y axis a little bit to level the out. There we go. Then I want you to click on my platform on on the X, which goes across just slowly move it so that it looks somewhere in the middle. Zed will bring it closer or farther away from us. So just have a play with it and put it where If you want now, when I press play, it should be centered up a little bit better. There we go. That looks cool, guys. Nice. Okay, so next thing, let's aren't the graphic user interface. 10. Project One Continued: So what we're going to do is we're going to add a canvas over the top off the game view. You can see in your mind's eye as a screen protector being placed on top of the mobile phone. And then we're going to right onto that screen protector, which will effectively give us graphic user interface over the top of the screen, which isn't distorted by the three D environment. So the first thing we need to do is come across to the hierarchy, right click. Go down to the user interface, and I want you to add a canvas that we go now. You can't see in the game view if I just come out to the scene view for a second and switch to two D. There we go. If I double click on the Converse, you can see look visual representation off our said screen protector over the top off the mobile phone screen. Now, the most important thing is that when you add some text awesome buttons to this canvas, that they will automatically scale to the reference resolution that were using on the way to do that is on the right hand side as a component here. Look for canvas scaler, and I want to change this to scale with screen size on that will handle any accessibility issues where, for example, we may add a button here. But then you try on a different device on the button is actually too big for the screen, and you only have half of it on or the button shrinks dramatically as it was designed for a smaller screen. And then when you loaded in onto, say, an iPod, everything is too small to actually interact with. So we're working on the game view with the reference resolution off 1334 by 7 50 which is the Eiffel for iPhone six even. And now, if we come across to the canvas on, we add some text, you can see this in action for just right click on the Converse here and then go down to you I and add some text. There we go. The text has appeared in the center. I'm just going to click The gooey scale element here are making nice um, big for a second and then on the eggs. I'm going to position that back into the center on on the why I'm going to change this to B minus of 100. Okay, Now don't worry about where it currently is. The pivot is centered on the actual canvas were about to change that now on the wrecked transform. Look, this is why you can change the pivots. So this little kind of X in the center is where it's blocked too. So minus 100 is 100 pixels down from this point. So let's point, let's connect the pivots of top like so There we go. Now it says that if I want to hold shift and old, I can automatically move whatever object this is to the top center. So let's do that. Hold shift, adult and click again. There we go. So now if I just minus 100 there is the text in the correct place. All I want to do now he's changed this to say a our car inside this text value here, and I'm going to change the font to the front that we've imported. Click here on the little the little dot that and then select the custom font. Then what I want you to do is come down to the front size. Just slowly pull this to the right and get it to the size that you're happy with. If you go too far, the text will actually disappear. And that's because it can't fit inside the box. Just pull this down a little bit more. There we go, just to make sure it's lined up nicely. I'm going to come down a bit further on the lining to the center on the center vertically. OK, I just put this up slightly. Okay, so now we have the title. Let's have a quick look at the game view and see if it's positions. Okay? I want to make it a little bit higher. So while it's selected here, remember, I'm not in play mode. I'm just gonna come across here to the right transform, and I'm going to decrease this so that the text actually goes a little bit higher up. Then we g o about minus 50. Let's make it a whole number. Nice. Okay, Ice. So what I want you to do next is named this the title on? Then I want you to press command E or control. De or right click. All three do the same, which is a duplicate. So now we have another version off this text over the top. I just wanted to move the X axis down to 100 so that we can see the two and switch back to the scene on the second text item here. It's going to say the word in upper case performance. There we go, and I just want you to drag the front size down so that the text fits nicely inside the box and about the same width and height as the original text above it. Then let's bring this down slightly, like so on. I'm going to change the color off the performance text to be something nice and bright like . That's, for example, Nice that we go. Some look at the game view. Okay, I like it. I like it. I think it looks pretty futuristic. I think it looked pretty tight tech. I like you guys. Let's press play and have a look at the two together. Yeah, this is coming together. Nice. This is going to look great. Okay, so next thing let's are a couple of buttons. The idea is that we have an arrow left and arrow right when you click on these arrows, then it will actually swapped the vehicle. Andi, down at the bottom. We're going to have a bottom here which will basically activate when you touch this, unload the a r experience with the current carpet selected. So come back to the scene View on. I want you to name this subtitle as subtitle on making a child off the original title so that we only have to move this parent on the both Both items were moved together. So now what I want you to do is click on the campus and we're going to create our first button on the left inside. So right, click. Come down to you, I unless creates a button. Then I want you to click on the right transform here, and we're going to pin the bottom to the bottom left hand corner off the canvas. So hold shift on Holt and click. Okay, so now let's adjust the width and the height. In fact, the width isn't too bad, but I'm going to increase it slightly toe 1 80 on the height 200. And now I'm just going to move it just using the grid as a background reference kind off this location here. There were also about 11 grid unit across which happens to be 157 on the why access from the bottom corner. Look on 85 in from the edge. Now I want you to expand the button and go to the text item. Then I want you to come across to the text and just add the arrow left, make it bold and then increase the font size. There we go. Now, don't worry about the cosmetics. For now. I want it to look like this. What? I want to change the background color a little bit to make it look a little bit more futuristic. Let's make it dark gray. Then click on the color bar and on the Alfa. I want you to drag that down toe about half way. Then I want you to change the on the text, change the color of the text to be white. Okay, let's have a quick look. Now this looks. There we go. I think that looks kind of cool on. It works if you click on it to I want to feel to be a little bit futuristic in a little bit high tech. So that's why I've gone for the semi transparent box as I find that that kind of works well with the theme off off the actual software. Okay, So if this button here is positioned 85 from the edge on this side, then let's rename the button to be left bottom. And then I want you to duplicate the button, Remember? With command D or command or control De, depending on what you're on, I don't want you to name this as the rock bottom. Then instead of being pinned to the bottom left hand corner, I want you to pin it to the bottom, right? But this time we're not going to hold shift in Olt. All I want you to do is change the minus too much. This button here, which is 85. I want you to change this minus to be about 285. So that's because it starts in the bottom left hand corner with this actual item. So we need to compensate with regards to how far away this corner is to the edge in comparison to this corner from this edge. So let's just moving across slightly just to make it about right that we go. I'm happy with that. So click on the text inside on. Just switch this to be the arrow pointing the other way on. Then click command, Save our control. Save and save the scene. Okay, guys, this this is coming together nicely. Really? Like the look of this. I think what we also need is a little quit button in the top left hand corner. Onda will be ready to wrap up this video on proceeding to the next one. So let's quickly duplicate the button on the left inside. Come on, D once more. I'm just going to pull this quit. And this time I'm going to click on hold, shift adults and move it to the top left that we go. So I quite like the idea of it being fixed into the corner. I just want to change the text inside to say quits on, then shrink it down a little. Here we go. Changed the funds to be the correct fund fact I need to make it up a case, take off the bold and then just shrink it down until it looks right to you guys. There we go. So I think that looks pretty nice as a quit button up in the corner. So let's duplicate the quick button now. Andi, I want you to hold shift and Ault and I want to position this in the top right hand corner on. What this one is going to do is this will be a button that triggers off contact information . So I'm just going to write the word info just to balance it cosmetically with the four letter word. You could put contact if you want, but very mind. You'll have to shrink the font size down, so the idea will be that when you open the application, it will by default, load one of the cars we'll have. A quit button in the corner here will have an information but in here, which will bring up a panel showing information, and you'll be able to switch through and select different vehicles. Once you've loaded the application and you're switching through, a button will appear here on. You can actually start the A R experience with the selected vehicle in the next video. We're also going to add the core particle effects for when the car switches on, I'll show you how toe animate the info button. Andi finally hook up the script to make all this scene come together. Fantastic. Okay, guys, we're flying. I'll see you in the next video. 11. Project1 intro Cleanup: Hi, guys. Welcome back. So I've just been driving away for a little bit while you guys caught up to speed. Now what I want to do next is a little bit off Teal c. So first things first, what I want you to do it just quickly switched to the game view. Now you can see when we put together the scene that the last thing we did was adequate in the info button. But if you have a look, the background look is overlap in this info button, just a little bit too much compared to the quick button on. I want to still look really nice and professional. So what I want to do is just correct that for a second now. So if we click on the main camera for a second, what I want to do is just rotate slightly on the Y access to balance out the to edges that we dio. Now what I'm going to to is on Quantum of the camera back slightly just to get these two edges lined up as close as I can. So it's a little bit picky, guys, I know, but I just want this to look professional for you guys. There we go. Now. Don't worry about the platform. We can easily move that back by clicking on my platform. I'm just adjusting the zed access on. There we go. So if a press play now, he should look nice on meat. There we go. It's looking great. Okay, The second minor minor thing. If we have a look at the scene for a second on double, click on the compass on, then switch to the two D view, you can see that. As I said, the last thing that we did was we added the quit on the info button, but I forgot to rename the info button, so that's what we're going to do now. There we go. So save the seed. And that's the a little bit of TLC done right now let's make this look a little bit cooler . Let's jump down in the two D view and double click on the platform. Here we go. Now what I want to do. Obviously, the platform is rotating as the game runs, but when the car first loads, what I wanted to do is start really small in the center here and then expand to be full size. I also want to make it spin into a nice little cool spin effect as the game first loads. Now what? I prepared for you already in the cars folder if we jump into the convertible down at the bottom. This Lamborghini has an animator, Andi, an animation already. However, that was put together for the full size version which isn't nested inside this object. So I want you to be aware that that exists as we can use it later on in the actual mean scene for the for the Lamborghini boats. I'm going to teach you how to do this from scratch. So come back up to the top of the assets on. I want you to right click and create a new folder like so. And then we're going to call this animations. There we go. Now, inside animations. I'm having an animation for my convertible. There we go. Lamborghini. Okay. Nice And meat. Double click inside there, and I want you to right click now and creates an animator. Now, if you new to this don't worry. Just follow along and I'll explain as we go. So I want you to create an animator controller. Cool this convertible on him, Troy, that we go Oh, whatever you guys want to call it now in order to animate any object, what we have to do is add an additional component. So if you click on the Lamborghini here, here is where we can add a component on what we're going to add is an animator an animate A component expects an animator to be drugged in as the controller here. So if we drank that in and drop it this allows us to apply animations to this game. Object So up at the top I have my animator panel If you can't see that, just click window on animator on their it iss Wow, this car is selected now if I click animator we are into the animator and a really cool little feature off The newest version of unity is you can scroll in and out now with the mouse button which is fantastic especially when you have complex animations It really, really makes life easier Now All we have at the moment is an empty animator controller. So when we press play, this is the state off the animation at the minute there are there isn't anything happening . So all happen. If I press play and switch to the animator for a second look, there's nothing going on at all. There's no base animations, so we're going to create an animation here. Down at the bottom. This is what I have my animation panel. I can't see window. Andi, where are you animation? There it is. Now what we're going to do is we're going to create an animation on. Here is a timeline, just like a roll of film. These are individual frames, Andi. It starts zero. Andi goes up to one second at the minute. But when we create our animator at our animation sorry. If you scroll out, you can increase this timeline and make it larger. Now what we're going to do is we're going to click, create, and we're going to make an animation called Spin Grow because that's exactly what is going to do. And just make sure it's in the right folder for a second. Yep, inside the Lamborghini folder, that's off perfectly fine. There we go. Look on. All of a sudden, our animation has being attached to this lumber gin it is orange because it's a default state. If I were to create another one or duplicate, it's one like so then it would have all the same properties. However, it would remain gray as only the default animation is, uh is orange. I'll just delete that for a second. Now watch what happens if I press play. When we switched to the animator, you can see Look that this animation, which isn't doing anything here he's just looping over and over again. So whatever we do here will happen in the amount of time that we specify to the game. Object here. Now, let's make this thing smaller on, then grow to be a much larger. So what we need to do is click on the Lamborghini on the first things first, let's copy the component here, so we're going to copy all these values in case we need them. Then I want you to click record, and what I want you to do is add a property we're going toe, add a transform and adjust its position by clicking this little plus, and that has added a key frame at the beginning and at the end now, at the end. This size is fine, but at the beginning I want these key frames to be smaller. So click on the key frames. And then while record is on, I want you to click a scale tool and then click the cube and scale the Lamborghini right down to about Not big. Okay, then I also want you to change the rotation on the why to be zero. Like so I want you to come to the minute mark. That was second Mark. Sorry. And I want you to paste the values that we just copied on resetting back that we go now watch what happens. It will go from the small state on over the period of one second. It will spin the car and stop at the exact position that we want so we can come out of record mode now on that animation has been created. So now when we go back to the animator, as that goes for one second, it will change the object from this state across the position, rotation and scale hope to the values here. Now, the only other thing that I want to do is if you double click on the animation. You can go inside inside. The inspector on. I wanted to not loop. So take that off there. Okay, save the scene and come back to the scene. Now watch what happens now? When we press play, the animation will play immediately. I think that we go. It's a little bit quick. Let's just make that a little bit slower. So if I click on the car and come down to the animation on, scroll out, let's do this over 1.5 seconds and see the speed. Ah, that looks pretty cool. In fact, if I make it a tiny bit slower, I think it will blend nicely into the rotation speed of the panel. Let's just increase that up to two seconds and see the difference. Well, that's very nice. Okay, cool. I like it. I like it. So now we've got a little transition effect on. We've applied it to our convertible Lamborghini. What I want to do is on the black plate. Here, I want you to right click on, create an empty game object. I want you to name this game object cars, and then I want you to drag the Lamborghini inside this new game object. It says that it will break the prefab, but that's totally fine because we're goingto great this Okay, now what we're going to do is we're going to rename this to be a little bit easier. What I want you to do now is I want you to come up to the cars on. We're going to drag out a few more vehicles and make them all Children off this new cars game object. So let's start with the orange Lamborghini. I want you to come into this object here, which is my prefab. It's basically an updated version off the original, except I've removed the lights on the Collide ist for performance reasons. So now I want you to drag mine out and place it as a child off cars on Look, my downloaded Lambeau. So what? We have to do its scale this to be the same size as this one. So let's scale this up until it's about the right size off the blue Lamborghini. I want to come over the top. Andi bless just making about the right size. This is a great time for the new transform multi tool because look I can move it around, and I'm just going to position it about the right size on top of the other Lamborghini have a different models, as in different model vehicles. So it doesn't matter if one's a little bit bigger. In fact, the the orange one is I think it's a grd, so it's supposed to be larger anyway. I'm just going to move it up. So it sits nicely on the platform that we g o on. Let's have another look about the right size. Maybe a bit too big. Still scary down. Move you up. There we go. Just going to hide the other Lamborghini temporarily for a second. Mr. Make life a little bit easier. I think it's sad quite nicely on the platform. Doesn't need to be centered a little bit more. Yeah, maybe pulling down a little bit from on the convertible for a second. There we go. Pull down. There we go. OK, so let's just have a quick look how this Lamborghini looks. If I press play, okay, cool. Now the other Lamborghini I disabled, which is why it's not that. But while we're in play mode, I can hide this one on. I can enable this one. Have a look. What happens, guys? It just spends up nicely. Disabled that one. And there's the other one. Okay, fantastic. OK, so now what we need to do is we need to do the same kind of animation. So what we're going to do is come into the assets animations convertible on. We're going to create a new animator on a new animation. We can't use the same one because the models different. So the size and the scale from this one compared to the old one will differ on. It won't give us the effect that we're actually wanted. So here we go. Right click on Let's simply create another animator controller on this could be for the orange Lamborghini. There we go. Let's click on the Lamborghini on drag in. The controller on now is go to the animation on Create a spin Grow for the orange Lambo. There we go. There's so many different ways of doing this. Guys, By the way, I'm just trying to keep things simple. You can share animations across multiple items, and we can detect scale and lots of things, but let's kiss it. Keep it simple. Okay, so let's pressure code. No. One second. Need to copy the component first. There we go. Pressure? He called. Andi lets out a property for the transform on press. There we go. Now all we need to do is shrink this down so that shrink this car right down. We're also going to need to bring him down to touch. And we go on this time, the rotations at minus three. So let's go to the end. Paste the component values that we go. Go back to the beginning on. I'm just going to rotate this about 260. Let's see how that looks. Zoom out. I made this over the same amount of time. Two seconds. Press play. Okay, I didn't do it. Let's put this up to about 1000 on. Let's see how that looks a little bit too much. Maybe about 7 20 close. That closer we can tweet this later on are In fact, I'm going to knock it down to 600. I think that's about the same amount of revolutions as the other one. Okay, brilliant. Let's come out with this. Go to the animator Andi. Just simply double click on this animation on take off looping. Now, when we press play, it should spend the orange Lamborghini in Cool on. If we disable this one, un enable the other. Here we go. Okay, so you can see the kind of thing, but I want you to dio So we're going to be hitting these buttons on. It's going to cycle through these vehicles. 12. Project1 intro Part2: Okay, lets grab one more car. Here we go. Assets car, pack cars on. We're going to grab in the Porsche police car. Now here is the original prefab. But if you look at the model, it doesn't have the word police on the side. Onda, The wheels were a little bit off when I first imported it. So I did a little bit of TLC on the model, and I created our own little prefab. So for drag my version out here and drop it on cars, we just have to scale this up accordingly, as it will be a lot smaller than the Lawrence. There we go. Let's bring it across. Let's have the top view again just to position the vehicle So he go rotate a car Now that I don't mind it being slightly smaller than the lumber Guineas as the port is smaller. Donnellan bikini. So let's just get rid of the lumber. Oh, for a second. And he is my little funky police car. Look, the text, by the way on the side All I did was I added a canvas on, then canvassing the center. Actually, you can see the outline Here, look So I added a converse and change the mode off the scaler. Where's the campus that we go? I changed it to be the world space rather than this screen space which made it so that I can shrink the compass down, having inside the actual three d world are then positioned to images as sub game objects and then just move them out. So they looked just like it was sat on the edge here. But look, you can see text is actually just on a canvas. So that's how I did that, in case you want to actually modify a car or at any any additional vinyls to anything. Okay, so I think the size is about right. The wheels need lifted up slightly, So just go to the top of the posh just move you up to sit you on nicely there. We dio Onda just want to reactivate one of the other cars just to make sure that this isn't too big. Yep, that's that's fine. Okay, cool. So here we go again. What we need to do is we need to shrink the car down, Aunt. Spin it. So here's the posh Let's come up to the assets into the animations. Andi, let's create another animator on This is the police car. Nice and easy, So let's click on the push. Drag the police car animates a controller into the animates a component. And then I want you to click animation and create the spin grow for the police. There we go. So nice and easy. Let's copy the original components Pressure cold and aunt a transformed position to add initial an initial key frame. Zoom out to two seconds on drag this key frame up here. There we go. I was going to pace the values in. Come back to the beginning for a second. All right. At the beginning, we're going to shrink this down, making sure except nicely. There we go. Be okay as it's going too small. Anyway, on now it's at 93. So let's move up to here on May s for size. Let's realty this about Steve 600 again And see how that looks. Must press play. Okay, done it again. I forgot to put this back to 93. There we go. That's press play now on a little bit too much. Let's make it minus for 80 Press play. Very, very close. Minus 4 20 Still too much. How about 36 day? Just do a spin. Yeah, that's OK. France is a little bit too less now. 3 80 There's no exact science to this guys. It's just a case of what you think Looks good on because thes models have come from various resource is they're never really going to be exactly the same anyway, So there is a little bit of trial and error. Okay, I'm okay with that one. So while the pool she's still selected into the animator, drag the animation double click on Take the loop off. Okay, let's press play and see how the post looks. Okay. True. I like it. So if we disable the push on enable the lumber Nice on the original Lamborghini brilliance . Okay, Nice. Nice. So we've got three cars loaded in. It's time to do the final car. So let's go into the chokers on drag from the pre Fabs folder. This is the only one. I didn't really touch me to drag this out into the cars as a child. There we go. So, as usual, it's a lot smaller. Let's scale you up. They may wonder why I've included this one, considering that we're using Lamborghinis and portions and things like that to just throw in a standard vehicle. Well, the reason is this vehicle has a few extra goodies. For example, you can lift the bonnet and can see the engine inside. Andi, you can open and close the doors very easily as well. So I thought it would be very good for the A R experience of That's why this one's included . Okay, the size is about, writes a bit big. There we go. I once a movie down Andi. I'm just going to rotate it slightly. There we go. Let's hide the portion. Now I'll make sure that the wheels are set up nicely. So let's bring this took us up that we dio and I'll show you. I mean, for a second when we animate this, if we click on the bonnet and just lift it up, look, you can see the engine inside, and I thought that would be pretty cool for the ER. So that's why these vehicles here, it's just century on the panel. I don't sport, otherwise it won't spin properly. Make sure it's there We go. Maybe shrink it down slightly. Once again, guys, just trial and error. Teoh. What you think looks OK, right? Let's spin the vehicle. So once again, inside the assets and animations, I'm actually going to rename this folder now to say car controllers instead, on Dhere we go. So let's create a new enemy to controller on this one is for the Tokars. There we go. So click on the Tokyo is drag in The animator Jump into animation. Copy the values. There we go and create a new animation. So kiss Oh, sorry, Spin, grow Tokars. There we go out of property for the trance. Fall for the position on Let's just shrink the car down. Keogh. Sure, it's sat well. Otherwise the shadow will be out okay on them That seem out. Pressure cord Sign. My bad. Bring that down. Let's bring you up to the two minute mark. There we go. Let's paste in paste in the component values. Here we go. So back down at the bottom. We need to rotate you. Uh, let's try. So Strife 3 80 as well. Um, come up to the end. Make sure let's just put this back to zero for a second. Let's press play and see how that looks. Okay, A little bit. Too much. 300 God, CASS. About. Right. Okay. Into the tomato. Drag the animation Aunt of a click on takeoff. Lupin! Save the scene. And let's give this a test press play. Okay, Cool. I think the car's a little bit officer. It's not actually positioned in the center. Let's go to the circus. Why? You have smaller for some reason. There we go. Let's put your values back. Yeah, I think it's a little bit off center. Move you across this press play and have a look. Okay, is better. Okay, guys, no problem. So good news. We have all four vehicles loaded in, and by all means, jump into that set store, go to a few online places such a CG trader on, have a look for the vehicles on trying import them and see how it actually looks. So what we're going to do next is make the buttons work so that when we click the buttons on the gooey, it will actually hide all the active cars on, then cycle through these only show in the one that we actually want to see on because when the object is inactive, the animator is also deactivated. When it's reactivated, the animation will play again and it will spin in. So if I disable you on, enable you when we're actually in play mode, then we go. The animated comes in, but when we click, the button that will be disabled on this one will be enabled on the animation. Okay, can again. However, when we click the back button, this will be disabled on this will be enabled on the animation will kick back in. Fantastic. So I'll see you in the next video, guys. 13. Car Selection Script: everybody welcome back. So it's now time to make a car selection script. It's the script which will hold the code to enable the toggle feature, which will happen when we click these buttons on it will switch the vehicle for us. Now there's a reason why I nested all these cars inside a game object called cars. And that's because we're going to make a dynamic script, which will look for all the Children inside this game. Object on at them to a list when we then it click the buttons. It will then increment through the list, activating on deactivated the relevant vehicles. So the first thing I wanted to do is click on the game object for cars, and I wanted to come across when we're going to add a new script. I just want you to write car selection on press return and then come down and click creating out, and that will add a script here in the panel at the bottom. That would go look, let's just create a new folder, Andi. Call that scripts so that we can keep everything nice and neat. Strike that inside on. There we go. So now let's click on the cars game. Object once more, and I want you to double click on where it says car selection to open up the script inside model develop. Okay, so come up to the top here. What we're going to do is we're going to create a private game object. However, if we're going to use the square brackets, which means that this will be an array. Now, Honore to the new people is just simply a list off objects. So normally you would write 0123 like this, Andi. Then these would be the items inside the array. Now, in this particular case, we're not going to know how big the list will bay. So I'm just going to create an empty game object array here and call it car list on. Then when the game begins, what I'm going to do as this script is attached to this game object. I'm going to count the child items inside and that will populate the list with the correct corresponding number, depending on how many vehicles we actually have. That way it will get around any errors, and it's open for expansion. If you want to add more vehicles, it will dynamically update on. Everything will work. Fine. Okay, So what I want to do now is get my car list on. I want to set that to be a new game object. And inside the array, I want to get the Transform child count. Okay, on as a as you can see here, it will give me the number of Children inside this transform. So just to make sense to the new people, here's a transformed look up here. And it's basically the position in the three D world. This script is attached to cars. Therefore, each child objects are the list. So if we add more, then we will dynamically change the amount of items inside this list. Okay, so now that we've counted the amount off objects inside, we now need to put one of the vehicle game objects in each one of the slots that we've just dynamically created on the way that we're going to do. This is with something called a four loop. Okay, So what followed will do Is Luke through all these items? Andi, continue to go until he gets to the end of the list. Now what? We're going to do is we're going to count each warm so that we can then cycle through that , using the buttons. So for that we need to know which index were actually on. So I'm going to make him into jail, which is a whole number called I, and I'm going to set it to be zero. So now we've set our initial interview I to be zero. What I want to do is say well, while ever I is less than the trumps form child, count in the list. Then I want you to add one toe I and continue in the little loop. So basically what this is doing is it's saying were starting at zero. I want you to make sure on loop over and over again until I becomes the same amount as the amount of Children in this transform on. Every time we get to the end, I want you to add 12 i so that the number will increase. Therefore, when I much is the same amount as the count, it will then stop and come out of the loop. So as we're looping through, what I now need to do is go to the car list. Onda basically at each slot that we've just created from the Count. I want to drop in the game object that's found so we don't know where we are in the count. So we're going to use this dynamic variable I. So what we need to do is set the current position in the array to equal the transform on, going to get a child at the index off. I So, whichever one we're currently on on, then get hold off that game object. So I said, a quick look at what we just don't. I've created an empty list, which we don't know how many there are in the list. So when the game begins, I want to get a hold of this list and I want to count how many Children this particular game object has on make the list that long. So that way, when we add more or remove any, then this will dynamic the change. So now that we've got a list with a bunch of empty slots, what I need to do is loop through all of the's on. We start at zero on every time we go around and through the list. We add 12 I and then when it gets to the same amount as what's in the list, it will break out while it's actually looping through the list. It will get ahold of the game object medics found in the same location as the current item in the list, and it will dynamically populate the list. So now we've populated our list. What I want to do now is I want to look through this list. I make sure that everything is set to inactive, so none off them or currently life. And then we're going to set the 1st 1 to be active afterwards. So the next step now will be toe loop through our list, and I'm going to set all the game objects to be inactive. We're then going to reactivate the 1st 1 in the index. So to do this, we're going to do before each loop. OK, so for each off the game objects that we actually find, which I'll just call a game O B J in my car list, then what I want to do is I want to get hold off the current game object and I want to set it active to be false, like so. So we're going to use an if condition. So if the car list on the first item inside that list is is true, meaning it has something in there. Then what I want you to do is I want to set from the car list the first item I want to set that to be true. Like so. Okay, so let's add a couple of comments in here just so that you can remember when you look back at this script, what this actually does. So over the top, we create an empty list off game objects. Okay, Now, we don't know how many are in the list. So here, what we do is we count the child game. Objects from the cars transform. There we go. Just change this to a D and other nest there. Okay, so we count the child game, objects from the cars transforms. We're counting all of the's on. Then we create the relevant amount of slots in our car list based on what we found. So on the next step, we then look through the child items. Andi, fill the list in the correct sloths. Once we've got the list populated, we then deactivate all the game objects in list. I'm Finally, we've set the initial game objects to be active. Okay, so let's save this on. Let's have a look just to see if we've got any errors. Now what I'm going to do is switch to the two D V three d view for a second and zoom down to my car's. Here we go. Now we can see that the blue car is active, so I'm actually going to do just to prove that this works is I'm going to deactivate the blue car on going toe. Activate the Porsche. So if I just come to the game view for a second look, there's a Porsche, but when I press play, the car script will count off thes, populate the list, deactivate everything and then reactivate the first item in the list. So as press play and hopefully we will see the blue convertible Lamborghini perfect. There we go, guys, it's working fantastically well. So now what we need to do is we need to make a bottom script that will enable this feature here, which will toggle through the list, activating on deactivating the relevant vehicles based on the current index that were at Okay, I'll see you in the next video where we'll tackle this exact problem. 14. Cycling The Buttons: Okay, guys, welcome back. So it's time to get these buttons actually working now. So in the last video, we created a list and then populated it with the vehicles. Now let's cycle through this list using these buttons. I'm just going to disable the portion for a second. As we don't need any vehicles to be live when the game fresh runs, let's jump into model, developed for a second and come down to the bottom. Now, I want you to delete the update function as we don't need it. But what we do need is a new public avoid. So it's not going to return anything. We're just going to simply call x function on it will switch between the cars. So what I'm going to call it is Tuggle, cause okay, so we're going to add an additional parameter now cold direction, okay? And this will be passed in from the actual button coal on. If the direction that's passed in is left, then we're going to cycle down through this list. Whereas if the direction is right, then we're going to increment through this list. Okay, So the first thing that I want to do is at an additional little variable up of the top just so we can keep track off the current car. Okay on. I'm going to set up to be zero right at the beginning out of the box. Okay, so the current car is zero. So what are first want to do is deactivate the current car as will be moving to a different direction. So if we go after the car list at the specific location that the current car is, which will be zero or one or two or three, depending on how many vehicles you have, and then I want to set that to be false, like so. Okay, so that would get rid of the initial car. Now all we need to do is check which direction we want to actually go. So if the direction is the same as the word, right, like so in upper case, it's important that we remember exactly how we've written this on and have a double equals . Which means is the same us. Otherwise, it will mean that the direction is always right. So there we go. So if the direction is the same as right, then what? I want to do is get ahold of the current car and I want to plus plus, which will increase the number by one. Okay, else, if the direction that we want to move in is actually left like so then I want to get a hold of the current car and I want to minus minus from the number which will increment or decrease this number here. Now the problem is, when it gets to minus one, then it will go out of range and we're going to get an error. So let's put a quick check in. So if the current car is less than zero, then we've obviously hit the Blue Lamborghini. So the thing that I want to happen is I wanted to jump right back to the end of the list for the Toker, so it gives the impression cycling through the different vehicles. So in order to do that, if the current car is lesson zero, meaning it's minus one, then let's set the current car to equal the car list. Length on that will count the items. However, when it counts them, it will count for, so the computer actually starts at zero, so it will be 0123 for the computer. But when the when we get the length, then it will return for So what we actually need to do is minus one at the end of that. Okay, so let's have a quick recap. If the directions right, then we're increments in this number. Otherwise, if it's left, then we're decreasing this number. However, if we hit zero or lessen zero meaning minus one, then start again. So that means that when we're up at the top, if we go an increment, this number on once we've gone past the amount that's in the list, then we're also going to get a no exception error. Seen that. We're trying to select an item that is not in the list, so we need to do another quick check. So if the current car is the same, US O. R. Is greater than even the car list length. Then what I want to do is set the current car back to be zero. Now we've deactivate to the car. We've checked it for going left or right down at the bottom here. What we actually want to do is set the current car to be active from the list. So let's get a hold off the car list. Andi, let's select the current car on Set that to be true. Like so Okay, lets rig this up on Let's have a look if this works. So it switched to the two D view for a second. Quick on the compass. If I zoom in the way that we read the buttons up, if you remember, is to select the left button, make sure you're on the bottom, not the text inside on. Come down in the inspector on. We can see that the bottom script is here. On in the on click event handler, I want you to click the plus I can hear, and we're going to drying in the game Object, which contains the script required. Now the game object that we want is the cars game object here. That's the one with the script attached, so that's drag that in here. Now we can click the drop down and select the car selection script that's attached to the car's game. Object on because we made are very our function public down here. Look, we've got Tuggle cars on because when we created total cars, we told it that we want to pass in a parameter, which is a string we can actually choose now and say that we want to go left. Andi, make sure that it's written exactly the same as is in your script. It has to match perfectly. I mean, if you want to, you can make this an integer on passing the zero on a one or a Boolean and passing true or false is completely up to you guys. I just wanted to use a string to make it easier to understand. Now let's rig up the right button. It's exactly the same way. Let's click the plus symbol dragging the cars. Choose the car selection script on that. Select the taco cast fortune. However, this time I want to go to the right with a Capital R. There we go. So let's save the scene. Press play on. Give this a run. Okay, so let's test these buttons out and see if it works. Let's go left. Fantastic. Look, it's cycling through nicely. Tokars. Ah, we've got an error outs of radio. You know what I've done, guys, You probably saw it as I was typing. I forgot to minus one off the end as the length that will be returned here will be greater than what the computer account for the actual car list has mentioned. I can't believe I told you exactly what the problem Waas and then I did it anyway. OK, we'll at least have seen the problem. Let's let's hope it works this time. So let's go right through the vehicles to the Tokyo's on them back to the beginning. Brilliant. Okay, just to show you guys the flexibility of this, I'm going to go back into the three D View and jumped down to the cars for a second on. I'm going to add a couple of additional game objects into our list. So on cars here, I'm going to right click on, Create a Cube. They're going to scale it up so that we can actually see the Cube one second there. We g o. Let's move it into the middle on and pull it up. I'm now going to duplicate this cube, are moving slightly to the right, duplicated again, moving slightly to left, duplicated again and move into the bok on duplicated Gana movie to the fronts. So now we have a load more. But just to show you the scale and how cool the script is, it's going to dynamically count all these. Deactivate the mall and add them to our index. So it's press play and have a quick look. Here we go. 123 Cube, Cube, Cube, Cube, Cube. Back to the beginning. Fantastic, guys. So this is running. I'm working exactly as I wanted, but we're not done yet. What we're going to do next is add some cool particle effects to simulate kind of a dust cloud explosion as the cars transform into the next vehicle. Okay, cool. So if you want to see that, I'll see you in the next video, guys. 15. Intro To Particle Effects: Okay, guys, welcome back. So it's time to have a bit of fun now Going to add a bit of life to this. This transitional effects that we've just creators we toggle through the vehicles on. We're going to add a particle system. Ah, love particles. Really cool. So what I want you to do is click on cars, right? Click and go down to effects in art. A particle system. Okay, now this Will Winston. She ate the initial particle system. It's currently facing the wrong direction on. I want to position it around the center of the vehicle. Okay, Now, what I'm going to do is I want to rotate, take upwards. So that's facing north. So minus 90 in the transform that we go, I'm come back around to the front. We can see the particle system look. Okay. It's a little bit off center. So there we go, back into the middle. Now it's currently set to the default, which isn't for particle. Andi. It's going a little bit fast. I'm a little bit too high on. I want to change the color, the speed and a few with a little cool effects. So the first thing that we're going to do is we're going to change the style rather than being a cone. I want you to come down to the shape. I don't need to change this to be a sphere. So the next thing is in the emission, I want you to change this to B seven. So there are a few a few less particles are emitting on. What I want you to do is come up to the top and change a start speed to be 0.75 And that will create a softer effect. I'm then going to change the start lifetime to be 1.5 seconds. Andi, I'm going to change the start size. Now, if you click the arrow to the right, we can change this to be between two different sizes. So I wanted to start small one's OK, but I want some of the particles to be larger. So let's increases to about seven. There we go. Look. So some of the particles air coming out very small and some of the particles are coming out family large, just going to move it up slightly, get a little bit closer to the camera just for the effect. There we go. Okay, so the next thing that we're going to do is we're going to adjust the color. So this start color I'm going toe also make this around between two colors. And I wanted to be like an electric blue cloud of smoke. So let's bring in a blue and let's come and give it some kind of gray effect. There we go. And then what I want to do is come right down to the bottom on over the lifetime of the particle. I'm going to change the color over Lifetime. Okay, so let's open this up and we can see the color here. Now, What I wanted to do is kind of feed in on, then fade out. So the bottom one is a color top one is the capacity, meaning the transparency. So what I want to do is click here. I'm going to bring the outfit down to zero, so it starts off at nothing like so I'm also going to go to the end and put that to zero. However, I want you to click about 1/3 in, and I want you to put the a paucity back to being full and then third towards the end on also put up to be full. So that means that the particles will fade in certainly on, then feed out as well. Look, it's already started to come together. Okay, let's increase the size slightly to about nine. So we have a little bit more dust cloud. There we go. Okay. Cool on. That's okay. Initially, for this first particle system, I'm just going to rename this as the cloud. Now what I want you to do is right click and I want you to duplicate this cloud particle system. And now look, if I if I while the 2nd 1 is selected, are just rename this us flash. If I drag this up, you can see that there's a second particle system inside now attached to the first video off this project. There was an additional PNG file, which I'm just about to import now. So if I importantly asset, the file that you guys need is spark. PNG is just simply a 5 12 by 5 12 image that I created in photo shop with a black background and then a sphere that's kind of squished down a little bit on the grainy into effect. Now, what I want you to do is I want you to right click on. We're going to create a new material called Spark On. Then while Spark is in the inspector, we're going to drag the spark into there as the albedo. Okay, so now we can see that we've created a material with our said spark on top of it. What I want you to do is change the Shada down to us particles and make it additive. What that will do is remove the background, which is the black area just showing the white. Okay. All right. So now we've got a custom little material, so I'm going to create a folder for my materials. And I'm going to drag both of thes inside my materials on, then going to go inside the materials folder on the original spark as it's only 5 12 by 5 12 on going to increase the quality toe high quality, but lower the maximum size 25 12 and click apply, and that will handle any optimization issues. So now we've got a custom material. What I want you to do is go to the flash and come down to the bottom to where it says renderers. Okay, now, at the moment it's got the default particle. But what I want you to do is drag the spark into this default particle. What's the change? There we go. Right. So now if we increase the speed a little bit to say 1.5, you can see a kind of glimmer effect. I'm also going to increase the lifetime to to to make it last a little longer. Andi. I'm going to lower the start size maximum amount to four to keep it nice and small. Now, finally, if you come down, we can add a little bit of noise. Now. Noise acts like wind turbulence, which will randomize a position off the particles. So it's just click noise and watch how that affects the actual particle system. Here we go. How cool is this? I think there's still a little bit big, so let's shrink start size down to say 0.45 on the maximum size to about Let's try 2.8. Okay, so now let's run demise the rotation. So the start rotation here, I'm going to make it a random between two constants of zero on 360 on that would give a rotating effect to this particle system. And then I'm going to change the end color to be white. Okay, Okay. The final thing. I'm just going to increase the rate to about 15. Maybe about 12. There we go. On that. What? It was kind of a nice effect, right? The last thing is to turn off looping on both the cloud. Andi, the flash. Okay, I want you to make the flash a child off the cloud on. I think the flash needs to be a little bit shorter, so let's make the lifetime 1.5 seconds as well. Okay, so now what we're going to do is we're going to make our particle system a prefab, which means it's a Templar that we can use over and over again. And we can also in Stan. She ate this. Which means start using script at whatever point in the app. Okay. Now to Winston, she an object. What we need to do is put the prefab inside. The resource is folder. So I'm going to rename this a little bit better. So I know it's the cloud particle. And then I'm going to drag this down into the resource folder and that will create a prefab off this object. I can now delete this from the scene as we're going to need this later on. Okay, cool. So let's jump back into the script now. When I set the new car to be active, I also want to create a new game object, which is the cloud system on I'm going to eat make this equal to And in Stan, she hated variable. So the way that we do this is we go into the resource is folder on. We use the load command to load in the particle system that I've created now, I called mine cloud particles, so that's exactly what you need to look for. Then what I'm going to do is create a particle system which will be named the cloud puff or explosion or whatever you want to call it. And we're going to set this to be the cloud system game of day that we've just in Stan. She hated. And once we've gotta hold off the game objects, we want to choose the particle system. Game components, which is attached to that game, object in the hierarchy. So there we go. So we're going to grab a hold off the particle system that is attached to that cloud. So what I'm actually doing then is I'm getting ahold of this game. Object from the resource is folder on and then creating a new dynamic particle system called Cloud Puff, which will grab a hold off the cloud system that would just loaded it will then go inside this game, object and get the component, which is named particle system on my mount. Need to make it play the particle system. So let's get the cloud puff. Andi, play that we go now we do need to position this as well. So what we're going to do is get the cloud puff and set the transform position to equal the transform position off the current game object that the script has touched it, which is the cars so effectively we are loading a particle system game object. We then navigate through to the correct component and get a whole of that and we press play . We then move this particle system instantly on grab a hold of this transformed position, which is this, and move it into the current transformed position off the object that this script is attached to, which is cars. Now it will need some adjustment as if I click on cars. Look, we can see that the game object is actually up back, so we will need to move this at some point, huh? We have our first error, guys. Let's have a quick look at the console it say's that we cannot convert a unity engine. Object to the unity engine game object. I'm I missing a cast. Okay, so where am I trying to convert an object with game object? Look at the code. So this is a objects I'm trying to load. Andi. I'm trying to make it a game object, but I forgot to cast it as a game object. There we go. So now it's loaded as a game object. I can assign it into the cloud system. Now we can navigate through the particle system, play the particle system on positioning somewhere close to the cars game objects, so hopefully that will disappear. Yeah, there we go. Unless press play and let's have a look what happens. So let's play on when I press a button assured load particle system somewhere there we go. So it's loaded, but it's loaded it at the back. So while we're in the game mode, I'm going to switch to the scene. Grab. My cloud system is not appeared in the correct location. So what I'm going to do, you want to move it into the center and have a look where I want it. So I want it to be at 22.13 or 22. Basically, I wanted a 22 0.1 on and 1.6 as I look up to air 1.5 that will do so. 20 to minus 11.5. Okay, so let's position it were actually wanted now. So the clamp off transform system, we're going to create a new rector. Three. Andi. I'm going to position it where I want it. So that's 22. 1.5 on dawn, the said, Let's have a look. I forgot where I actually wanted it is is bringing across so 0.901 will do 22 on minus 1.31 Okay, so let's have a look now and put this at minus 1.31 f A 1.3. That'll do. Okay, like so now, after this has been a Stan she hated what it actually does is create a clone in the hierarchy on the left hand side. Look like so, Cloud particle clone. It's a little bit high sunny to bring that down. Just go back to the scene. Bring this down. So let's give it a new location. Let's bring it right down. Put it down to minus nor 0.5. So it's actually starts underneath. Okay, let's have a look How this looks. I'm fine. Okay. The positions cool. But the particle system is too long. Let's just jump back into the resource is on drug out my particle system. Temporarily. I put looping back on for a second. Just while we're actually plane with this thing. Go. Stop on. Start. You again. Here we go. So it lasts a bit too long. So the first initial cloud needs to be a second. There we go on. Then The flash were also going to make you about a second as well. Okay, Now, I want you to click on the cloud particle and apply the changes and then delete this from the scene. So now when I press play, it should be a little bit less time. So, Booth, there we go. They're still to our forgot to take off. Looping. Okay, so here's the initial want. Let's take off. Looping. Click the second on. Tick off, looping. I'm also going to change the duration down to B two seconds. 1.75 I think that should be it now, guys. So let's just press play again, okay? Hopefully, this is perfect. So next boom. Ah, cool. I like it. So the only thing is that we're actually creating additional cloned particle systems. So eventually, this will use up quite a lot of the memory on the mobile device. And if you're jumping through quite a lot, then basically it's going to lag the application out. So, seniors, they last for a maximum of two seconds. What we're going to do is a little bit of a cleanup on. Once this has bean created, we're then going to destroy the object. Now, the cloud system is a game object that the particle system is embedded inside. So let's go after the cloud system. Onda. Then after two seconds, I want to destroy the cloud system. So that's the one that's actually named as the cologne. So if a press play now, here we go. When I click the button, we have the clone and it should disappear. There we go. Look, we've got a nice little bit of garbage collection going on on. Keeps the application running really efficiently. Okay, Cool. I'm liking Leah. I'm liking the look of this guys. I think we're doing really well. Okay. Brilliant. I'll see you in the next video. 16. Out Particle Cloud: leave on dawn. The said, Let's have a look. I forgot where I actually wanted in four days. Just bring it across. So 0.901 will do. 22 on minus 1.31 Okay, so let's have a look now and put this at minus 1.31 f A 1.3. That'll do. Okay, like so now, after this has been a Stan she hated what it actually does is create a clone in the hierarchy on the left hand side. Look like so, Cloud Particle Club. It's a little bit high, so I need to bring that down. Just go back to the scene. Bring this down. So let's give it a new location. Let's bring it right down. Put it down to minus nor 0.5. So it's actually starts underneath. Okay, let's have a look. How this looks where I am. Fine. Okay. The positions cool. But the particle system is too long. Let's just go back into the resource is on drug out my particle system temporarily. I put looping back on for a second, just while we're actually playing with this thing. Go stop on start. You again. There we go. So it lasts a bit too long. So the first initial cloud needs to be a second where we go on then the flash were also going to make you about a second as well. Okay, Now, I want you to click on the cloud particle and apply the changes and then delete this from the scene. So now when I press play, it should be a little bit less time. So, Booth, there we go. They're still to our forgot to take off. Looping. Okay, so here's the initial want. Let's take off. Looping. Click the second on. Tick off, looping. I'm also going to change the duration down to B two seconds. 1.75 I think that should be it now, guys. So let's just press play again. Okay? On. Hopefully, this is perfect. So next. Ah, cool. I like it. So the only thing is that we're actually creating additional cloned particle systems. So eventually, this will use up quite a lot of the memory on the mobile device. And if you're jumping through quite a lot, then basically it's going to lag the application out. So, seniors, they last for a maximum of two seconds. What we're going to do is a little bit of a cleanup on. Once this has Bean created, we're then going to destroy the object. Now, the cloud system is a game object that the particle system is embedded inside. So let's go after the cloud system. Onda. Then after two seconds, I want to destroy the cloud system. So that's the one that's actually named as the cologne. So if a press play now, here we go. When I click the button, we have the clone and it should disappear. There we go. Look, we've got a nice little bit of garbage collection going on on. Keeps the application running really efficiently. Okay, Cool. I'm liking the I'm liking the look of this guys. I think we're doing really well. Okay, Brilliant. I'll see you in the next video. 17. Completing The Car Intro App: Okay, everybody, welcome back. So it's time to finish off the intro scene on move on to the actual are experiencing where we can then connect the up to the AI bots on, do the animations and make everything start to come together. Okay, the first thing that we need to do is make it so that we can actually transition from this scene to the next scene. Now, what I'm going to do to make this happen is I'm going to create a script here for create an empty squid game object. I'm just going to call it game controller. There we go. And I'm going toe Add a script. Cold game controller. You can spell the word control of today. There we go and creates an odd on. Then when the circle has finished spinning and updating there we go out, drop the game controller into the scripts. Don't know why the game You zoomed in for a second and I just stood back out. Here we go. Right now. This game controller here is what we're going to use to control which vehicle will be shown to us on the next scene on. It's also going to hold the code to exit out of the application. It's not going to have the cold for the info button as that's actually unique to the scene . So it will probably throw an error in the next scene if this info button doesn't appear now . What we need to do then is we need to create a button in the middle of the scene that will then call a function right click on the Converse, and I want you to go to you. I button. Now I'm on the game view just so I can position this a little bit better with the actual platform and everything visible. I'm going to change the height of the button to be 3 50 and let's change the width to be about the same. Then I'm going to pull the Y position down to cover over the central section of the application. Okay, now expand the bottom and go to the text. Just go to the scene for a second. Andi, I'm going to bring the tanks down so it just sits across the bottom like So Now if I change the text to say touch car to start and then I come down and I click this best fit. Watch how it automatically adjust the size. There we go now where to change the color to be white and come down to the bottom and add a shadow component with an ex off three and a Y of 32 minute. Stand out a little bit more and then click on the button. And I want you to come back up on where it says color frankly, outfit to zero so it goes invisible. There we go. So the bottom was still work. It's just invisible to the user now. If I just switched to the game view again, just make sure that my text is visible. Yep, Touch Carter star. That's not bad position wires in the buttons over the top. Now what we need to do is Eddie our game controller script so that it has a function to exit out of the application and we're going to create something called a static variable. Now, if you remember when we looked at the other script, got to my car selection script you can see here. Look, we have a private into Jekyll current car. We've got private game object now these variables are just for the script, and they are relative to whichever game object they're attached to now. The difference in that type of variable on a static variable is that the static variable is shared and has changed by other objects. To demonstrate this, I'll just show you quickly, and it will make more sense if I open up my game, control the script to wait for. It's a load properly. There we go up at the top. What would normally have is either a private Boolean, for example, called whatever we want, or we'd have a public bullion called Whatever we Want. Now these will be relative to this script. So whenever I attached the script to a game object, then the game out it will be able to change these on. It will affect this script dynamically. But what we're going to do now is we're going to create a public static variable, which will actually be a string on what I want to do. You get the current selected Come on. Okay, I'll just set it blank for now, but we need to name it in a second Now, what this does here means another script will be able to access this variable and changes value dynamically from its own script. So, for example, if I come down to the update on, I just print out the current selected car at the moment it will be blank. I'll just write the word hello in there for now and save the script. Now. Do you remember The update statement runs between 30 and 60 frames a second, so this will happen quite a lot in the D Block section. But what I want to do because we've created a static variable if we go across to the car selection script now on down here online 49 where it creates and sets the current car to be active well, now I could update the game controller script, and I can access that current selected car, and I can set its value to be whichever one of selected from the current list off the cars on, then get its name. So if I save this, make sure the game controller saved us well. Initially, when the game loads, it will just say hello in the D book section in the console. But when I pressed the bottoms the car control the script as it switches and activates. One of the vehicles were then jump through to the game controller on update that variable on because ecstatic, it will remain open and set while the application is running. So when we switch seen or we have to do is access that same variable from the game, control the script on its value would have been carried through from this current scene. It's a far simpler way off, passing information from one scene to another in comparison to something like jumping into the player preferences, for example, which we don't actually need to dio. So here we go. Let's let's give it a quick test run. If I just press play for a second, we'll have the D book saying hello down at the bottom. But when I press this button, there we go. Porsche Tokyo has on the Lamborghini. Now you notice that when it first loads, the variable isn't set. Now there are lots of ways of doing that. What? I could do it. I could jump in, and I could update the script to get the first item that selected in the list on which ones active, but for this example that we we don't need to mess around with all that kind of cold. I know exactly which one is going to be active first, so I don't mind making an exception. I'm just simply setting the current string to be the My Lambo convert text. But this one's white, which means it's not the prefab, so I'm going to click it and click, apply on this disappear. There we go. So now it knows exactly which one I want to access when I'm on a different scene. So if I just get the name off my Lambo, there we go. I'm just going to use that. That's the initial text. So, like I said, we could look through our, make it more flexible, more dynamic, but we don't really need to. We're just it's overkill for what we're doing at the minute. In the future, if you wanted to change this around or add loads more or even remove this and yeah, you'd have to change the string. But I don't need to do that right now, so let's give it another run. I press play now. The initial text should be to the console my Lambo convert look, and that's the right vehicle. I switch vehicle and it becomes my Lambo downloaded. Okay, cool. So that's working. So I'm quite happy to get rid of this now can get rid the update statement completely on what going to do is we're going to create a new function, which will be to quit out of the application. Now all we have to do for this as an inbuilt command and it's application dot quits on. We call the function, save the script, and what this it will do is it will use the system preferences on which have a device cross platform and close the application. So if if it's on a desktop, it will close the equivalent of pressing the X. If it's on Android, is equivalent, depressing the button of bottom corners. Or if it's on an iPhone or tablet, it just like pressing the button down at the bottom of the iPhone, and that will handle a fishing for us. So let's save that and hook up the quick button. So let me just find you. There you are. There's a quick bottom. So if I come down here on click at an event, and I'm going to drag my game control in down in the function list to the game controller. And she was quit. And now this bottom or work, it won't work in the editor, but it will work once we've exported this to an actual device. So the only other thing that we need to do is make this bottom work here and make this contact bottom work. So what I'm going to do, I'm going to quickly create a new scene. Yeah, I'll save this one. Now, this scene. I'm just going to save it as the main scene that we go. So now in the project, we have to And while this is safe, I'm going to jump back to the intro. Double clicking. There we go on. I'm going to make this button work here. I make it switch seen from the intro to the main. So let's go to the scene. Open the compass and here's the bottom. So I just call this button load scene. Now we go. Now. I'm also going to drug in the game controller for now, but I still need to write the function, so I jump back into the game Control on up at the top. What I want you to do is make sure that you're using the unity engine. Seen management script. Okay. No, that means that we can create a public void called change level or change. Seen. We're going to passing a string, which will be called the scene. That way we can change which scene we want and use the same function. Basically, when this is called, what I want to do is go to the scene. Manager Andi, load a scene and it asked for a string, which is a scene name. So I just need to write the word scene on that will dynamically change depending on what we pass in. So here we go. Click on the load scene that script update in the corner on. Then we come. Let's go down to game controller. Change level on in this box. I'm going to write the name of the scene I want to go to, which is main There we go on, save the scene. So let's test it. One more thing. We need to make sure in the build settings that the new scene is added so on seconds. Drug main in there we go. Otherwise we're going to get an error. Now we compress. Play on a top intro dot unity. Now the only thing I haven't done is as with this current seen, I haven't added the the euphoria behavior script and disabled it so that that will automatically attach to the main camera in the new Seen as in the build settings here in the player settings we've enabled augmented reality. So when I click here now, you won't see them to see. You will see me high with bad lighting today. Sorry, guys, but there you go. It works fantastically well. Now the only thing left then is this info button. So what I want to do is click on campus and we're going to create a U I panel. There we go now. Panel by Defoe covers the entire seen Well, converse, I'm not so ok in this particular case. But I want to do is change the color to be black. I make it so you can only just see through. So about 200 on the Alfa. Here we go Now I want to right click on the panel on We're going to create a text object. Just move it over here slightly, Make it a bit bigger. Now we g o Andi, I'm going to change the color to be white and take best fit and change the text to say office phone on. Shrink the hike slightly. There we go. Move you across now we g o office phone. Now what I'm going to do is duplicate this. I make it a child. I moved this across. This will just be a random number. So it could be an 0 801 23456 for example. We're gonna change the color to be a blue, like so then I'm going to duplicate this entire game, objects. I'm really down, and then I'm going to expand. You just name you to be phone. I name you to be email. Then I'm going to change the text, Say office email on in this second section, I'll just put info at a our car dot com. There we go. So now we have a panel over the top, which will pop up and say the office phone number on the office email address. All we need now is a button to actually close this panel. So let's create a button, just move it down slightly and increase the height About 100. The width is okay, but the color wants to change. All right, you black with white text and all it will say is close tunnel. I just want to increase the fun. Tsai slightly. Now we go. Let's increase the width a little bit as well on the bottom, just to make it look a little bit nicer. There we go, close panels. Just press play for a second, see how this looks you have that sits over the top quite nicely. Although as it's a button such as the info on the quit, I'm going to change the text to be the same text as the other one, just to make you look a little bit cooler on. If I drop the Alfa down slightly like so it would give an outline impression on the button that we go. Okay, cool. So let's make this work right. I'm going to zoom out on. What we're going to do is we're going to make an animation now renamed the panel to be called in for panel there we go on. All the values are at zero. Look, now what I'm going to do is just move it off scene like so. So all we have to do is creating animation, which will put these values back to zero on. It was slowly move the panel upwards. So while the panel selected Let's come down and create an animation, I would just call this born info on him. There we go. Now. If I press record, I can create a key frame. Oh, at a property on the wreck. Transform. Don't just change the any, really. This one will do just to add a key frame. There we go. So at the beginning, that's where it ISS go to the end and what I want to do. It's set these values to be zero on zero like so, and I feel play. There we go. We've got a slide action going on there. Cool. Okay, so let's take out of record. Go back to the beginning Now. What I want to do is make sure this animation doesn't play automatically and it also doesn't loop. So if you go to the project, let's quickly put these two into the Animations folder and let's click on the Info panel and have a look at the animator for the Info panel. So he is the animation just going to double click on takeoff, Luke. Time on that will prevent it from actually playing over and over again. And if you go to the info panel or to come down on select, call it completely on the cooling mode, which stopped the animation from playing. So now when I press plate shouldn't move, There we go, so it's not going anywhere. Okay, so what I want to do is when you click info, I want to actually trigger this animation, and then we'll click close. I want to trigger the animation, but in reverse to make it slide down. So it's quickly jumped to the animator on then commodity and duplicate this on. That will mean that we can then go to the speed and put minus one, which will reverse the animation. I'm just going to change the name to be reverse. I'm press return, so when it starts, info on him is the one that's kicked that kicks in Andi info on him. Reverse. It just sat there waiting for us to actually, trigger has come back to the scene on on the info panel. We're just going to add a little script here, which will be info panel on him. There we go on creates an odd because we've attached to script in actual panel, which has the animator. Now we can automatically access those animations and set them off and trigger them off to my heart's content. So if I open up this one, here we go. What I'm going to do is create an animator called I mean. 18. Cleaning Up: in the start. I'm going, Teoh, get the component. So Uneme equals gets components on. We're going to grab the animator components. Now we go and now will be able to create a couple of functions which will play difference animations. Now, there are a few different ways that we can actually make this happen. What I'm going to dio is I'm going to create two functions. Well, we'll play the animation on the other one will play the second animation. So we're going to make a public void which will be called play slide. There we go on. Then we're going to make another one that will be called close slide. Okay, so now what I want to do is go after the name and I'm going to play. All I have to do is give it the name of the animation I want to play. So if I quickly jumped back to the animator for a second, the name is info on him. Says, grab you, pop, you in here on, then on the close slide, I'm going to go after the reverse. I mean, in theory, we could re fact to this I'm just passing a string and make one function, as we did a minute ago with the with game controller. Like so. But I like keeping things separate sometimes. Okay, so let's make it work. Click on the info button. Here we go on the info, but turn down to the on click event. That's Dragon the and four panel on Call the place slide function. There we go. Then I want you to click on the button, which is the close panel, which are just rename now and was simply going to do the same dragging the info panel. But this time we're going to call the clothes slide function and safe the scene. Okay, I'm just going to correct the animated down here so we can watch what happens. Here we go on, just press play on. Let's have a look. So here we go. The animation stopped, and I'm just going to come up. Click info. Andi still stopped. Apologies, guys. Long story show. I'm I stop. I've just finished working on another project, and I'm confusing myself for a second. Right? Quick fix. Really sorry about this guy's All I Want you to Do is right. Click on create an empty state here, which we will call Idol. And I want you to right click on that and make that the default state. Okay, now everything else is fine. What happened is that on the info panel, if I call completely then I need to use the animation commands to actually fire the animations rather than the animator. So if we switch, call completely back to always animate on save the scene, everything should be fine. So apologies for that, guys, I just confused myself. I leave this in the video as well, on purpose just so that you guys can actually see the simple it is to do something like that, I think and go wrong. Now, guys, everything's going according to plan. If I click info, then a panel should switch. I'll bring the enemy to back down to the bottom. Here we are, Andi. When I click the info button, it should switch to the info on him and play the slide. There we go. Lovely, lovely. Lovely on. The buttons are covered. Look. So we can't come out anywhere else other than the clothes panel. When I click this, it should go back down on there. We go. Perfect. Just double check again. We come on, down we go. Okay. Guys apologised for that one. I'm I should have made a default State on then Created the two animation rather than trying to stop the first animation in the first place. But it's a two second fix, as you've just seen. Okay, so right. Good news. Then everything works. We can move on to the next scene and start putting this thing together. Fantastic, guys. Right. I'll see you in the next video. 19. Making Unity Connect To The AI: Okay, everybody, welcome back. So we've just successfully completed the intro scene for the A R car performance up we had a lot of hands on work on. I'm sure that you've learned or picked up a couple of tricks along the way. I feel like this would be a good time, though, to jump back across now into the A I section. So what we're going to do is we're going to use the main scene here. We're going to start building an interface that we're going to use, which will enable us to communicate without online box. So this is where it starts to really come together. Guys, what I want you to do first is pause a video on download, the little goody park that I've put together. Now what I've decided to do in this section to make things speed up a little bit, I make things a little bit easier, as the last section was very hands on. This section is also hands on, but not as intensive. So in the Goodie Park, I've pre written a few scripts on. Then we just need to expand on the scripts, so I'll explain exactly what everything does along the way on. Then we're going to add a few more functions so that you can get a full grasp off exactly what you need to do, right? Well, I've already got my goodie pack downloaded on extracted here. It is likely speech back, so I'm just going to drag that into unity. Move the software back over here, and we'll have a quick look. What's inside. Here we go. There it is. So here's the speech part I've put together for you guys. Now, if we open up the folder you can see inside, there's a record button. First thing I want you to do is click on the record button and change the texture. Type to be a sprite to D and then come down and click. Apply. That will let Unity know that this is not a texture. It's actually an image that we want to use as it's going to be used for the button. The next one is Isa logo. So let's do the exact same thing to school down on. Apply. Here we are. There we go. That's the logo enough. So the backgrounds being knocked out and you can see that it's appeared G. Hi, guys. This is just a mini intersection off the video because I've come back on updated a little bit off the code. Now, on the folder that you've imported, you will see a folder up bottom called Jason dot net. Now, on the original video that you've just been watching for a second, that was just one file. However, due to the new version of IOS, I've had to update this and change it for a folder which has a few additional files inside . Everything else is exactly the same. So don't worry. If you see the folder on you don't see the Jason dot dll file. Okay, Just a quick update Video, just in case your project folder looks slightly different than the video. So don't worry, everything's fine. Okay, Back to it. OK, moving on. I've included a pre fabs folder, So if you remember for the new guys, these are just template game objects that I've saved. One of them is a game object that has a script attached to it, and we need to assign these in a second. The 2nd 1 is just a bottom that I created on saved Andi it's ready to be hooked up to the script as well. So it's just a few times savers that I wanted to give you guys. Let's come back up again on Have a look at the next file. Now this is a sample audiophile. Every time we record our voice, this file will be over, written by what we've said, and then it will be sent through to the bots on the Internet. The boat will then convert text the speech to text, try to understand what we've said and then return us the correspondence off What it thinks it wants us to say. So provided we've trained about well enough, it should give us the right answers. Nine times out of 10. Okay, so the following folder is he Scripts folder. This contains the files needed to interact with the wit. A I. I'll explain each one as we use it, but as a brief overview Whit three day is the file that is required to communicate with wit . What this one does is it starts the microphone, records a voice on, then sends that across to this file, which is save wife on what this does. You guessed it. It actually saves the dot wife audio file on it does all the conversion into the correct four marks to make it a riel audio foul that could be sent through an interpreter on the other side by wit, The handle is a file that I've put together, which will handle the response So this will be passed in the response from the bots, and it will then loop through, figure out what was said on act Accordingly, based on the actual intent. The final one is deploy stage once. Now this is an additional file from View Fauria. That's part of their online documentation on what this file is for is for the second part off this little section. Now there are two ways of creating the augmented reality experience based on the technology that exists today. 1st 1 is where we use something called a user defined target. So in the 10 minute challenge, we used an image target where we had to print off a natural image on then, when the software recognize the markers on the image, then projected the object on top of that image. What user defined target will do is it will project onto any target that we choose. So instead of using an image target with a pre defined image or photograph on it, we can use any objects any flat surface with a little bit of detail. For example, you could use a magazine cover. You could use a newspaper or a business card. Or you can stand outside and provided that the road outside or the ground that you're stood on has enough definition are a pattern or or slabs on the floor or cracks or something like that. Then the software will use those on anchor to those specific points. What I really like about user defined targets is that the scale off the objects is determined by the distance away from the target. So if I have a magazine cover on the table in front of me on, I take a photograph close up where the phone is just a few inches away from the actual magazine, then the object will be projected to a small scale based on the distance and more about devices away from that particular object. However, if I stand further away, for example, I hold my mobile device about a meter above the magazine than the objects will be projected in a much, much larger scale. So it's a cool way for us to be able to dictate the size off the experience. The 2nd 1 is the brand new technology from of euphoria. Now you may have seen examples of this in Apple's A Arc It on in Google's A our core. They use something called ground planes. Okay, so you don't need a target act old. What happens is the mobile will detect flat surfaces in general so you could walk outside onto the street on hold the mobile device up. The camera will then scan the area, and it will decide where the ground is. All we have to do it slowly moved the comer down. Take a photograph off the area, the target position that we want to project the item and it will use which ever surface the camera can see so it could shoot the table in front of you. Or you can walk outside into the middle of the street on place, an object in the middle of the road. Ground planes are fantastic, and the technology is getting better and better every day. There's only one drawback At the moment, it's only available on IOS devices running IOS 11. So that's basically an iPod Pro Woods or an iPhone six s upwards. Nothing below that because it requires what's called the A nine chip. So it's an actual specific chip that's inside those devices. If you four you have now taken this a little bit further, they've created something called Euphoria Fusion. Now what that does is it's a cross platform application. So when we export from unity to an IOS device, it will actually use the libraries for a arc it Andi compile the software so that it will work using a arc It. However, if we build for Android, it will use the compiler IHS on build for an android device so it will either use a Arcor or it will use the inbuilt Euphoria library to actually generate the same experience. What's cool about using re for you, then, is that we can build cross platform using the same piece of kit. So the one drawback then about this new fantastic technology is that it's only on the most current mobile devices. Now there is a list. I'll save this link and added, as one of the additional resource is on the left hand side off this video along with the downloadable files. So the ground planes which uses this new tech that you don't actually need an image target at all the condition was a normal flat surface. It's true. Markle s technology only works on these IOS devices Now. The cool thing about euphoria, though, is that they've made it work on Android as well, including some of the A r core assets on their own technology. So down here, a little further Look, then these are the device is that it works on. Basically, it works on something s six and upwards and then a handful off other mobile phones. However, the good news is that the A r core team at Google have declared that they will make there are core technology at work across thousands of mobile. So in the coming few months were currently in the beginning February. In the coming few months, this list will become much, much more extensive. The only thing that you need to pay attention to is that you need to patch the software which basically means download the most recent version or update to be able to use the ground plates. So why am I telling you all this? Well, basically, what I've decided to do to cater for both types off students, the ones who have the newer devices on everybody else. I've decided to split the project from this point now into two sections. What's going to happen is when you click touch the car to start, they're going to be presented with an instruction panel, which say's exactly what they need to do. Press the record button, say the command impressive record, but to begin to stop to see the actual augmented reality experience change. But it will say, Are you indoors or outdoors? Now? The user defying target works a little bit better indoors on that will be accessible for everybody. So we're going to have a button that say's I'm indoors on. That's going to take us through to a scene that uses the user defined Target the UDT. However, if the user clicks are outdoors, then I'm going to build with the new ground plane Mark Ellis technology for this side. So as a developer, you guys get to see both sides now there is a downloadable file that we can print off so that even if you don't have one of these devices, you can still test the ground plane technology. When we import the ground planes asset from the asset store, there's included in the package. There's an actual principle a four documents on. We can print off a target, which will act like the software has actually detected a ground plane successfully. So there's no problem for anybody throughout this process in act
meta: {"url": "https://www.skillshare.com/en/classes/Unity-Tutorial-Part-1-Discover-Voice-Controlled-AR-With-A-Cloud-AI-%E2%9C%85/242803432?via=similar-classes", "partition": "head_middle", "language": "en", "source_domain": "www.skillshare.com", "date_download": "2023-03-20T08:50:54Z", "digest": "sha1:6RGJCUPZAY56RKH5KLA2476ZAKJBSUCH"}