Search Unity

Tutorial: Build a maze game level within Unity using GameDraw

April 7, 2012 in Games | 5 min. read
Placeholder image Unity 2
Placeholder image Unity 2
Topics covered
Share

Is this article helpful for you?

Thank you for your feedback!

GameDraw is a 3D modeling extension for Unity developed by Mixed Dimensions that reduces the time you use on switching back and forth between a modeling program and Unity.GameDraw provides the ability to model, edit, optimize meshes, and easily convert textures to meshes, right inside the Unity Editor!

Among the great features GameDraw provides:

  • Vertices and triangle editing
  • Subdivision
  • Extrusion
  • Assigning new materials
  • Vertex welding
  • Triangle deletion
  • Boolean operations
  • An extended set of primitives
  • Sculpting
  • Decimation
  • UV editing, copying and exporting
  • 2D to 3D conversion
  • Node-based editor

Installation

Once you download GameDraw from the Asset Store, Unity’s mesh filter editor gets automatically updated with all the options from GameDraw. Six tabs are immediately visible in the Inspector to give you fast access to GameDraw’s features.

Istallation

The maze level

In this tutorial we’ll create a level in which you must traverse a maze from a starting point to a small house on the other side. All models will be created with GameDraw within Unity! We’ll be using the 2D to 3D feature, which allows you to proceed from tracing an image into a mesh, to creating the maze itself, and then we’ll model the house using the editing capabilities within GameDraw. Here’s the map for this level:.

Istallation

Generating the maze model from an image

One of the unique features of GameDraw is the ability to directly trace an image into a mesh. This is what we will use to get the maze model up and running within seconds, without even moving a single vertex from its location.

First, we need to import the image that we want to turn into a mesh. You can download that imageright here. Once that’s done, we simply use any Game Object with a mesh filter to access GameDraw. From GameDraw, we select Create->Utilities->2Dto3D, then we click on Create new 2D element. A save dialog will appear, so choose any name, select a location for the element, and click Save.

Istallation

Once you save the file, you’ll have more options to choose from. Click on the new window which appears, as demonstrated below. We’ll select the image we want to trace in the texture slot and click on Trace. You should see small points on the edges of the image. If there’s something wrong and you see missing points or improperly positioned points, play around with the settings until you are satisfied with the result and close the window afterward.

Istallation

When you close the window you’ll be able to generate a mesh from the 2D element. You can replace the current mesh by toggling Replace Mesh; generate different parts as Game Objects by toggling Generate as Children, and merge sub meshes to get a single material.

In GameDraw, you’ll find construction types such as Layers2D to generate flat surfaces andLayers3D to generate extruded surfaces. However, you’ll first need to set up an extrusion.

In our case we’ll use Layers3D. Select Generate As Children, then click on Update Mesh, which will generate the Game Objects and their meshes. You should end up with the following:

Istallation

By this point, we’ve have created the maze itself. Next, let’s create the house at the end of the maze.

Modeling the house

Istallation

To start modeling the house, we first create a cube either from Unity’s primitives or from the primitives included with GameDraw. GameDraw ships with 25 extended primitives and includes the means to also easily add your own.Once we create the cube, we’llGameDraw->Edit and click on the triangle selection button, which is the second button at the top of the edit tab. Select the top triangles, which should be highlighted in green. Next, click on Extrude to extrude the selection, and then move upwards. Continue working with this operation to generate the different parts of the building, including window and door offsets, as seen in the screenshots below:

Assigning materials and UV manipulation

Once we finish modeling the house, we’ll need to assign materials to the different parts of the building, as well as to manipulate its UVs to fit just right.To assign materials we simply select the desired triangles from the Edit tab. Select a material in the Material tab under the Assign New Material settings. Then, click on the Assign New Material button in the upper right corner of theEdit tab.

To fix UVs, go to the UV Tab then click on Make Cubic. Other available options are spherical and planar. Then rotate, scale or translate the UVs until they fit the model’s needs. To work on specific parts of the mesh UV coordinates, there is a simple UV editor that can be used to manipulate each UV coordinate individually.

Istallation

Conclusion

By now you should have learned to use GameDraw to trace 2D images into 3D, create and edit models, assign materials and manipulate UVs, and build a complete level from scratch. And entirely within Unity!

This is just an example of the many powerful features included in GameDraw, but it’s certainly not all of them. In addition, we’re regularly releasing new updates and have a strong roadmap with new features in the works, including a procedural cities system, poly reduction brush, sprite support and more!

For more information

You can learn more about GameDraw from http://www.gamedraw3d.com and you can access the documentation here or simply follow Mixed Dimensions on: Twitter: @MXDimensions orFacebook: Facebook.com/MXDimensions

April 7, 2012 in Games | 5 min. read

Is this article helpful for you?

Thank you for your feedback!

Topics covered