Viewers: in countries Watching now:
Interested in game making? Start in Unity—a game engine for mobile and desktop games and real-time simulations. Author Adam Crespi shows techniques used in game development with Unity and introduces the basics of scripting and game functionality. First, learn how to import models and textures, organize your project and hierarchies, and add terrain, water, and foliage. Next, Adam explores how to use lighting to bring the game to life, and add rendering, particles, and interactivity. The end result is a sample game with a lush environment, fully animated characters, and some basic interactive gameplay.
The new 2D tools in Unity have a new 2D set of physics components available. I'll put some colliders on my cars to start, and we'll see that they're much like their counterparts in 3D. I'll start out by looking at the bottom cars. I'll select them, and, with their sprite selected, I'm going to put on a box collider. It's the simplest kind of collider available and to do this I'll chose Component>Physics 2D. And we can see in here in the colliders that they're standard kind of colliders. Circle colliders instead of spheres.
Box 2D colliders instead of 3D boxes. Edge colliders and polygon colliders. There's also a collection of joints to use such as springs and hinges in 2D. I'll put on to these bottom cars a box collider, so that cars generally stack up and bounce on top of this, rather than colliding with each one uniquely. Next, I'll look at some of my other cars and put colliders on them. I'll choose the three cars and they'll get a box as well. As a note here on selecting, clicking on them seems to select the background.
So, what I'll do is select them by a window here, and make sure I grab all of those cars. Once I've windowed around their entire sprite, it selects. Alternatively, I can pick them in the hierarchy just like any other object. For these again, I'll choose Component>Physics 2D>Box Collider. Next, I'll pick the single car next to it. I'd like this one to collide a little closer, so I'll use a mesh collider by choosing Component>Physics 2D>Polygon Collider. What this does is based on the alpha channel, draw a quick polygon collider for that car.
I'll zoom in and take a quick look and we can see in here that it fairly faithfully follows that sprite. It does a good job of optimizing that collider around there. Now, this is the most expensive kind of collider to use. It's equivalent to the mesh collider in 3D where it's a tremendous amount of over head to use a mesh collider versus a box collider. But for specific instances like this car, the polygon collider will work nicely. With this polygon collider then, like with our colliders in 3D, we can see we can put on a physics material.
And this corresponds to the physic materials in 3D, where if we bring in that package, we have different choices available of the way things react. There's also collider info, the number of vertices in that polygon collider. And this will let us keep track of how it's working, if we need to do a custom collider, or if we should run with a box or an edge. Finally, I'll get polygon colliders on my other two cars. This white one will animate, and so I want it to cleanly contact the bumper of the one it's next to. Now that all of my cars have 2D colliders, I'm ready to get my physics and animation going.
It's just like working in physics in 3D, where we bring in our meshes, and then put colliders on. Seeking to optimize our colliders as much as possible. Judging how an object need to contact If the player's going to hit it, and whatever else we need to think of to really optimize the game play. So we're not dealing in solving a whole bunch of just mesh colliders. Now I can get some rigid bodies on. And, after that, I'll get that white car animated, and see if I can get my painting to come to life; letting the cars hit each other when they're triggered by the player.
There are currently no FAQs about Unity 4.3 Essential Training.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.