unity 构建迷宫_教程:使用GameDraw在Unity中构建迷宫游戏关卡

unity 构建迷宫_教程:使用GameDraw在Unity中构建迷宫游戏关卡_第1张图片

unity 构建迷宫

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!

GameDraw是由 Mixed Dimensions 开发的Unity的3D建模扩展 ,可减少您在建模程序和Unity之间来回切换的时间.GameDraw提供了建模,编辑,优化网格以及轻松将纹理转换为网格的功能。在Unity编辑器中!

Among the great features GameDraw provides:

GameDraw提供的出色功能包括:

    安装 (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.

    从Asset Store下载GameDraw之后,Unity的网格过滤器编辑器会使用GameDraw中的所有选项自动更新。 在检查器中可以立即看到六个选项卡,以便您快速访问GameDraw的功能。

    迷宫级别 (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:.

    在本教程中,我们将创建一个关卡,您必须在该关卡中从起点到另一边的一所小房子。 所有模型都将在Unity中使用GameDraw创建! 我们将使用2D到3D功能,该功能使您可以从将图像跟踪到网格中,创建迷宫本身,然后使用GameDraw中的编辑功能为房屋建模。 这是此级别的地图:

    从图像生成迷宫模型 (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.

    GameDraw的独特功能之一是能够直接将图像跟踪到网格中。 这就是我们将用来在几秒钟内启动并运行迷宫模型的方法,甚至不需要从其位置移动单个顶点。

    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.

    首先,我们需要导入要变成网格的图像。 您可以在此处下载该图像。 完成后,我们只需使用带有网格过滤器的任何Game Object即可访问GameDraw。 从GameDraw中,选择Create-> Utilities-> 2Dto3D ,然后单击Create new 2D element 。 将出现一个保存对话框,因此选择任何名称,为元素选择一个位置,然后单击“ 保存”

    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.

    保存文件后,您将有更多选择。 单击出现的新窗口,如下所示。 我们将在纹理插槽中选择要跟踪的图像,然后单击“ 跟踪” 。 您应该在图像边缘看到小点。 如果出了点问题,而您发现缺少的点或位置不正确的点,请尝试设置,直到对结果满意为止,然后关闭窗口。

    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.

    关闭窗口时,您将能够从2D元素生成网格。 您可以通过切换“ 替换网格”来替换当前网 ; 通过切换“生成为子代”来生成不同的部分作为游戏对象,并合并子网格以获得单个材质。

    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.

    在GameDraw中,您将找到诸如Layers2D的生成类型来生成平坦表面,以及Layers3D的生成类型来生成拉伸表面。 但是,您首先需要设置一个拉伸。

    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:

    在我们的例子中,我们将使用Layers3D 。 选择“生成为子代” ,然后单击“更新网格” ,这将生成游戏对象及其网格。 您应该以以下内容结束:

    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)

    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:

    要开始为房屋建模,我们首先要根据Unity的原语或GameDraw随附的原语创建一个多维数据集。 GameDraw附带了25种扩展原语,并提供了轻松添加自己的方法。一旦创建了多维数据集,我们将进行GameDraw-> Edit并单击三角形选择按钮,这是编辑选项卡顶部的第二个按钮。 选择顶部的三角形,应将其突出显示为绿色。 接下来,单击“ 拉伸”以拉伸选区,然后向上移动。 继续使用此操作来生成建筑物的不同部分,包括窗户和门的偏移量,如以下屏幕截图所示:

    Assigning materials and UV manipulation

    分配材料和UV操作

    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.

    完成房屋建模后,我们需要将材料分配给建筑物的不同部分,并操纵其UV以使其恰好适合。要分配材料,我们只需从“ 编辑”选项卡中选择所需的三角形即可。 在“ 分配新材料”设置下的“ 材料”选项卡中选择一种材料。 然后,单击“ 编辑”选项卡右上角的“分配新材料”按钮。

    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.

    要修复UV,请转到UV选项卡,然后单击Make Cubic 。 其他可用的选项是球形和平面的。 然后旋转,缩放或平移UV,直到它们满足模型的需求。 要处理网格UV坐标的特定部分,有一个简单的UV编辑器,可用于单独处理每个UV坐标。

    结论 (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!

    到现在为止,您应该已经学会了使用GameDraw将2D图像跟踪到3D,创建和编辑模型,分配材质和操纵UV,以及从头开始构建完整的关卡。 完全在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!

    这只是GameDraw中包含的许多强大功能的示例,但当然并不是全部。 此外,我们会定期发布新的更新,并制定了具有新功能的强大路线图,其中包括程序性城市系统,多边形减少笔刷,精灵支持等!

    想要查询更多的信息 (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

    您可以从http://www.gamedraw3d.com了解有关GameDraw的更多信息,也可以在此处访问文档,也可以在以下网站上遵循“ 混合尺寸 ”:Twitter: @MXDimensions或Facebook:Facebook.com/MXDimensions

    翻译自: https://blogs.unity3d.com/2012/04/07/tutorial-build-a-maze-game-level-within-unity-using-gamedraw/

    unity 构建迷宫

    你可能感兴趣的:(游戏,python,java,unity,游戏开发)