Create Your First Augmented Reality Game Without Code // Reality Composer Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
You can create your very own augmented reality game using just an iPhone. Want to know how? This video is for you. Hi, my name is Ryan Kopinsky and today I will show you how to create your very own augmented reality game without writing a single line of code and using just an iPhone. So let's get started. What you'll need is an iPhone and an app called Reality Composer. Reality Composer is an app made by Apple that is free to download for your iPhone, iPad and Mac. In this case, we're using it on iPhone. When you open up Reality Composer and create a new project, you're presented with a screen saying "Choose an Anchor." An anchor is a way to attach augmented reality content to the physical world. And so every AR experience needs an anchor. In this case, you have a variety of anchors that you can choose from. A horizontal anchor, a vertical anchor, image, face or object anchor. We're creating a game of bowling and in this case we're going to use a horizontal surface to lay out a set of pins and then throw a bowling ball at those pins. And so we'll be using a horizontal anchor. So, when you tap on horizontal anchor, a new scene is created and it comes with default content that we don't need. So, we're gonna delete it. We're going to tap on the cube tap on it again and then select delete. And then the same thing for the default text. Now if this is your first time using Reality Composer, I highly recommend you watch my basics video that I'll link up here and in the description below. In this video, I assume that you have some experience with Reality Composer. And so the first thing we're gonna do is lay out our game. We need bowling pins and a bowling ball. And so to add content to our scene, we're gonna tap the plus icon, and that opens up our content library. And this is all free content that Apple provides to us in Reality Composer. So, we're gonna scroll down and look for a bowling pin. There we go. When you tap on it, the bowling pin gets added to the scene. If this is your first time using the app, you may see a cube and a loading icon. This means that the content is being downloaded, so just wait a few seconds and then you should see the bowling pin. Now if you want to change the way something looks in the scene, you do it in the object inspector. And so we're going to tap on the bowling pin and then select the object inspector. Here you can see the transform which is the position, the rotation or the orientation, and the scale. What we want to do for now, is just look at the styling of it. You have a stylized pin, you have iconic, and then you have realistic. I really love the way the realistic looks. It even has like the dirt and like the shine, it is just beautiful. And so we're going to use the realistic bowling pin. Now since we're playing a game of bowling, these pins have to behave in a physically realistic way, which means we have to enable physics for these pins. And so you can do that by selecting participates and then selecting the motion type as dynamic. Now I'm not going to go into too much detail between fixed and dynamic motion types, for now just assume that you're using dynamic. But this enables the pin to actually behave in a physics simulation, which is needed for any game. And so that's all we have to do for the bowling pin. So we can close our object inspector. Now the next thing we have to do is add our bowling ball. And so we're gonna again tap on the plus icon and now select our bowling ball. As you can see, it's being placed right next to our pin and it looks actually really awesome but we're also gonna make this a realistic bowling ball. And so when we select that and close our object inspector, we see there is like a beautiful shine to it and it looks really realistic. We're gonna open up the object inspector again because now we want to again enable our physics for the bowling ball. Because when we throw the bowling ball, we want it to react and collide with our pins. And so we're going to select participate and again select dynamic. And that's all we have to do for our bowling ball. Now, when you have a game of bowling, you have the ball in front of it and then you have a few pins. I believe the number of pins is ten, in this case we'll just add a few just to show you how to create the game. But you should be free to experiment, do whatever you feel is needed to make your bowling game the best game ever. And so what we're going to do is we're going to use our positional transforms, these cones, to drag and position the ball in place. I'm gonna try and center it in front of the bowling pin. But to do it accurately, what you really want to do is use the object inspector with the transforms. So I want to position the bowling ball two meters in front of the bowling pin. And so I'm gonna so set it to 200 centimeters on the z axis, which is 2 meters. And then we're gonna do return and you'll see that the bowling ball now is 2 meters in front of the bowling pin. We're also going to center it in the x-direction and so we're going to set that to 0 in the x axis. And so now we have our bowling ball positioned right in front of our bowling pin. Now, if you've ever played bowling, there's more than one pin. So we're going to actually create more of them. You can add them in from the content library or you can select the bowling pin and select duplicate. This is much easier because it already duplicates also the physics and the look. And so we're just gonna position these. Now you should take your time to position your bowling pins as well so I'm just going to do that right now. Create a few pins just so we can simulate a cool game. Okay. And so while I'm doing this, if you haven't subscribed already, please consider subscribing. I really enjoy making these videos and it is very encouraging to you know to see that you are enjoying it as well. So if you're enjoying the videos and they're helpful, please consider subscribing. I really appreciate it. Okay and so now we have our arrangement. So you may notice that it's a little bit difficult to interact with the scene on an iPhone just because how small the screen actually is. It's actually much easier to use this app on an iPad or a Mac, but I just wanted to show you that you know you can be on the metro or a train going home and literally make your own augmented reality game, which is mind-blowing to me. And so that's why I did it on the iPhone. Okay so now we have our pins and our bowling ball, so yay if you have that too. What I also want to add is a reset button. Because when you throw the ball, and if you want to play again you need to be able to reset the game. And so that's what we're gonna do. I'm going to tap on the plus icon and in this case we're just going to select a very primitive shape, in this case, a cylinder. We're gonna move the cylinder out of the game space. Just put it to the side. Then, we're gonna do some editing of it. So we're gonna make it a plastic material and then for the color what I want to do is add it make it red. Because when you press reset, you know you want to show the user hey you don't just want to press this button because it's going to reset your game. Okay and then the final thing that we have to do for the layout is the text. I want to add some text that says "Reset." And that way your your player knows oh this will reset my game. So we're going to position it right in front of the button and we're going to edit the text to say "Reset." Okay let's change that to reset. Great. And so we're ... okay now just to show you how these transforms work. So you saw how it the circles turned from blue, green, and now red. So those are used to rotate it. And so when you see the red circle like that if you drag on it you can see that it's positioning it it's rotating about that axis, the z axis I believe. And so now we have it at 30 degrees. And I think that looks pretty good. Great. Okay, so in just a few minutes we were able to lay out our content for a game. Now any game usually has actions or behaviors where you have to program and you have to write a lot of software for it. But I'm gonna show you how to do the behaviors without writing a single line of code. So let's do that. To access the behaviors, what we're gonna do is we're gonna select more options, which is the icon with the three dots in the top right corner. And then, we're gonna select behaviors. As you can see there's no behavior currently because this was a new scene. And so we're gonna create our very first behavior. Now remember this, any behavior needs two things: a trigger and an action. You can have one trigger only but you can have multiple actions. In this game I'm only going to show you one of each. And so there's many triggers you can use: tap and flip, tap and play sound, and these are all pre-programmed behaviors. But I'm gonna show you how to create your very own behavior using a custom behavior. Feel free to actually play with the other triggers. It's really fascinating to see what comes built-in into this app. And so when we have our custom behavior what we're going to do next is select our trigger. When you select a trigger there is a tap so you can activate your behavior by tapping on an object. You can activate your behavior by when the scene starts or where the game starts. When the proximity to camera so when you're when your phone is close to the object that it affects. Or when it's colliding. In this case we're going to keep it simple and just select tap. Now when you when I select a tap, you see a yellow dot. Keep that in mind, we're gonna come back to that. For the ball to actually move what we're gonna do is we're gonna add force and so we're gonna select our force action. And now you see a message saying "Select the affected objects for the add force action." And we see the same yellow dot under the action icon. This is because we haven't really told Reality Composer which object we want to apply a force to. And so when you select an object that you actually want to be affected, it becomes green and highlighted. And you also now see one object. We only want the ball to have the force action so we're going to select done. And now that we select done and we've selected which object is affected, you see an arrow with some dots next to it. This shows the direction of the force. Now when you play bowling, you don't want to throw it up you want to throw it forward. And so we're gonna drag the arrow just I'm just dragging it using my thumb and drag it down so it's facing forward. And then we're also going to update the speed to 40 kilometers an hour. Now that's probably really fast but I mean this is augmented reality we can do whatever we want. I think it's gonna be fun to see how fast it can go. But we're not done yet. And the reason why we're not done is because we still have a yellow dot on our tap trigger icon. And so when we select that, we get the same message that we don't have any object selected to trigger the behavior. And so again we're going to select our ball. So whenever you you know if you were to run this and the ball doesn't move, check back to your triggers and your actions to see that you've selected the affected optics that you need to select. And now we're going to say done. So then we have that. Now when we go back to our behaviors list, we just have the name "Behavior." We want to organize our scene and our behaviors in a way that makes sense for other people, if you collaborate with them. And so we're gonna press and hold our behavior and now you see more options. We're gonna select rename and enter in "Throw Ball." So this is our throw ball behavior. Okay. And the only thing that that's left to do is actually to program our reset button. Because we want to reset our scene so if you throw the ball and you want to play again then you press the reset button. And so we're going to again create a new behavior, do custom and then again a tap trigger, and we're gonna do... So there isn't really an action that just resets the scene, but we're gonna hack it. We're going to use "Change Scene" as the action and what this does this usually is used for changing between scenes in your AR experience but when you select the same scene that you were in, it resets to its original state. Which means it resets our game. And so that's what we're going to use as a trick. So we're gonna select our scene. There's only one scene in this case. So we have our scene selected. Now we don't have a yellow dot in the action but we have one in our trigger and so we're gonna select the reset text and the reset button. So now you see affected objects has two objects and we're going to select done. So we have no yellow warnings anymore and so our game now is really done. So to test it in the simulator, all you have to do is press play in the top bar. And now you're presented with this. Just the game. And when I tap on the ball you can see it shoots through the the bowling pins and we don't have a strike but it was really cool to see it actually hit the bowling pins. Now if you want to play again because it is just so much fun then you press reset and we're back to the beginning and the pins are reset and so we're gonna press it again and hit it. Now we also want to test it in augmented reality so I'm gonna show you a demo of how it works in augmented reality. Feel free to experiment with it and make this your own add more stuff to it. But yeah this was really fun. And so to test it in AR mode, we're going to tap on the AR button. Now you can see the pins and the ball laid out in my office. Now to play the actual game you press play and then you tap on a bowling ball and it just shoots against the pins and it is really awesome. You can reset the game to play it again and just tap on the ball and then shoot it again. And that's how simple it is to create your very own augmented reality game in a matter of minutes without writing any code and using just your iPhone. I hope I inspired you to create your very own AR game and if this video was helpful to you I would really appreciate you giving it a like. If you have any questions leave a comment below and subscribe to see more videos like these.
Info
Channel: Reality School
Views: 8,731
Rating: undefined out of 5
Keywords: Reality Composer, RealityComposer, reality composer tutorial, reality composer apple, reality composer ios, reality composer ipad, reality composer demo, reality composer ar, reality composer, reality composer app, reality composer ios 13, reality composer animation, Reality Composer behavior, Reality Composer game, Reality Composer How To, No Code Tutorial, No Coding Required, Augmented Reality Tutorial, How To Augmented Reality, Get Started with AR, AR for Beginners
Id: A5dITRwB7xo
Channel Id: undefined
Length: 15min 41sec (941 seconds)
Published: Thu Feb 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.