Remember that at any time, if you make a mistake you can use 'Ctrl + Z' or 'Ctrl + Shift + Z' to undo and redo respectively. If you run into any issues with hotkeys not working properly, make sure your mouse cursor is over the 3D window and then try again. The mouse cursor is the largest, most user-unfriendly part of Blender.
Getting Started
We want to create a new scene in Blender. Pressing 'Ctrl + N' to bring up the new scene menu, then 'R' to reload the starting scene.
With your cursor over the new 3D view window (and not any of the side menus) press 'A' to deselect the cube, and then 'A' again to select everything in the scene (Pressing 'A' will select and deselect everything in a window)
Now press 'Delete' to bring up the delete menu, and then 'D' to confirm the deletion process.
Pressing 1, 3, or 7 on the Numpad will toggle between front, right, and top perspectives (respectively). We want the top perspective; so press 'Numpad 7' (make sure 'NumLock' is on and your cursor is still over the 3D window if you have any issues).
Now that we are looking down on the X and Z axis from the Y, we can start creating the level.
Creating a Plane
We want to make sure before we move on that the 3D cursor is centered at (0,0,0); we do this by pressing 'Shift + S' (to bring up the cursor menu) and then 'R' to snap the cursor to the center.
Now that the 3D cursor is centered, we can add an object. Pressing 'SpaceBar' will bring up your quick menu. We want a Plane, so type "plane" (you don't need to click in the search box, just type) and hit 'Enter (Return)' to create a new plane object.
Scaling the Plane
Press 'S' to scale the object; taking into account the plane starts as a 2x2 area, remember that scaling by 20 will result in a 40x40 plane. For this example we will use 20 to keep this tutorial in-line with the previous tutorial to create a uniform area that will spawn different "rooms" in each designated space upon scene load.
We now have a 40x40 plane, which we will use as the base of our level. 'Mouse Scroll Wheel Down' to zoom out (making sure your cursor is over the 3D window if you have an issue)
Subdividing the Plane
From here we want to designate the playfield inside the model. To make the level as uniform as possible, we will use the Subdivide tool. In order to use this tool we need to put Blender into Edit mode. This is easily achieved by pressing the 'Tab' button to toggle between Edit and Object modes.
You can press 'Space' to bring up the quick menu, type "sub", then push 'Arrow Key Down' to highlight the Subdivide option, and hit enter. Alternatively, on the left hand side of the screen is a menu called Mesh, with a sub-menu called Add, with the Subdivide option nested inside. Either of these methods will split the plane into 4 pieces, as well as bring up the Subdivide menu on the left hand side of the screen (under where the Mesh menu was located).
More Subdivisions Through Cuts
Now, we need more parts than just 4, so in that Subdivide menu is an option called "Number of Cuts", it should currently be set to 1, this tool allows you to divide as many times as you want up to 10 per "face"; we want to set it to 10 for this example.
Remember, you will have spaces equal to "Area / (Cuts + 1) ^2". In this example we have spaces that are 3.636363^2 (repeating of course), but we will simply round that up to 3.6364^2 (This number should look familiar if you read the "Calculating Block Sizes for Surrounding a Uniform Pattern" tutorial). If you are going for efficiency, do not ever round higher than the thousandths place; the more places, the more accurate your calculations are going to be later.
Now we have an area cut into 121 equal spaces, and we can start mapping.
Press 'A' to deselect everything.
Changing to Face Selection Mode
On the bottom of the screen, you have 3 parallel options (which look like cubes with orange sections on them); "Vertex select" is currently highlighted, and the one on the far right is "Face select" option. This is the one we will be working with. Click it and each of your 121 spaces should now have a small black box in the center of them.
Designating the Floor Panels Using Faces
With your cursor back over the 3D View window, press 'B' to activate the area select tool.
Select the blocks you wish to make floors from by holding 'Left-Click' and highlighting the black box in each area (if you hold 'B' during this process it will stay active after 'Left-Click' is no longer held). If you select a wrong block, simply repeat the above process, using the 'Center-Mouse (Scroll Wheel) Button' to deselect blocks.
Extruding the Floor Into Negative Space to Create Walls
Once you have a pattern you like, look on the left side menu for a tool called "Extrude Region" (located above the Subdivide option). Clicking it will allow you to move the floor up and down, since we are making floors, we will go down. Type the size you wish to adjust the height of the floor to, remembering that since you are going down, we want to go into negative space. For this example, we will use -4. Press 'Enter' to confirm the transformation.
Press 'A' until everything is deselected.
Optional: Adding an Entrance/Exit
Now, if you are going to need an entrance (or exit) you will want to select one of the very side faces on the newly formed wall using 'Right-Click', and press 'Delete', then 'F' (or select Faces from the delete menu) to delete the wall's face from the object. This allows the player to enter or leave the object.
Moving the Object Out of Negative Space
If you have made all the changes you want, the last thing we need to do is move the object out of negative space. To do this, simply press 'A' until everything is selected, then press 'G' to grab, 'Z' to snap everything to the z-axis and move it up as many units as you went down during the Extrude process by typing the number (remembering you are now working in positive space, if you went down -4, then you would move it up 4 (not by -4 again).
Saving the Object to Import into Unity
'A' to deselect everything, and then 'Tab' to re-enter "Object Mode". You must be in object mode when you save in order for it to be placed properly in Unity.
Steps for Creating a Uniform-Position Prefab in Unity
1. Import the file into Unity.
2. Create a new "Empty Game Object" and move it to position (0,0,0).
3. Put the model you just made into the Hierarchy and change its position to (25,0,25).
4. Add a "Mesh Collider" to it.
5. Drag the positioned model into the Empty Game Object.
6. Rename it to whatever you want.
7. Save it as a prefab so you don't have to repeat steps 1-6 again.









No comments:
Post a Comment