untiy3d15教程Word文档下载推荐.docx

上传人:b****6 文档编号:18659765 上传时间:2022-12-31 格式:DOCX 页数:27 大小:403.19KB
下载 相关 举报
untiy3d15教程Word文档下载推荐.docx_第1页
第1页 / 共27页
untiy3d15教程Word文档下载推荐.docx_第2页
第2页 / 共27页
untiy3d15教程Word文档下载推荐.docx_第3页
第3页 / 共27页
untiy3d15教程Word文档下载推荐.docx_第4页
第4页 / 共27页
untiy3d15教程Word文档下载推荐.docx_第5页
第5页 / 共27页
点击查看更多>>
下载资源
资源描述

untiy3d15教程Word文档下载推荐.docx

《untiy3d15教程Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《untiy3d15教程Word文档下载推荐.docx(27页珍藏版)》请在冰豆网上搜索。

untiy3d15教程Word文档下载推荐.docx

 

我们有许多在线教程。

点击这里去我们最后更新的网站

(注意,此教程请在网上查看,翻译省略)

经典GUI(教程)

本教程介绍Unity图形用户接口(GUI)的主要功能。

假定你没有Unity的知识。

完成时间:

3-4个小时

经典脚本(教程)

脚本是unity中的精华部分,定义你游戏的行为。

本教程将介绍使用Javascript脚本的基本原理。

2个小时。

IntroductiontotheUnityInterfaceUnity界面入门

ThistutorialwillintroducetheUnitygraphicaluserinterface(GUI).

本教程将介绍Unity的图形用户界面(GUI)

NopriorknowledgeofUnityisassumed.

假定没有Unity预先知识

Timetocomplete:

1hour.时间1小时

Author:

GrahamMcAllister

作者:

GrahamMcAllister

Contents目录

1.Aimsofthetutorial本教程的目标

2.Screenlayout屏幕布局

3.Findinggameobjects发现游戏对象

4.Creatinggameobjects创建游戏对象

5.NavigatingtheSceneView定位场景视图

6.Movinggameobjects移动游戏对象

7.GameView游戏视图

8.Resizinggameobjects伸缩游戏对象

9.Usingassets使用资产

10.AddingComponents添加组件

11.Duplicate复制(对象)

1.Aimsofthistutorial教程目标

IfyouarenewtoUnitythisshouldbethefirsttutorialthatyouread.Itwillexplainthekeysectionsoftheinterfaceanddescribehowtocreatebasicgameobjectsandpositionthemin3Dspace.

如果你对Unity的不熟悉,这应该是你个阅读的第一个教程。

它将讲解界面的关键章节和描述如何创建基本游戏对象和在3D空间定位它们。

TodemonstratetheUnityinterfaceessentials,we’llcreateasimplescenewhichwillallowacharactertowalkaroundonasurface.

示范Unity经典界面,我们将建立一个简单的场景,允许一个角色在表面行走。

Note:

anytextthatrequirestheusertotakeanactionbeginswitha‘-’.

注意:

需要用户创建的一个动作以“_”开始的任意字符串。

2.ScreenLayout场景布局

Beforewestart,let’smakesureourscreenlayoutisin2Splitmode.

-Toensureitis,selectWindow->

Layouts->

2Split.Yourviewisnowsplitinto5mainregions:

在我们开始之前,让我们确保我们的屏幕布局在2个分割的模式。

确保它是,选择Window->

2Split(窗口->

布局->

2个分割模式,注意:

在2.5forwindows版本里没有这个布局选项)。

你的视图现在是分割成5个主要区域。

1SceneView-forplacinggameobjects场景视图—用于放置游戏对象

2GameView-thisishowthegamewilllookwhenrun.游戏视图—它是当游戏运行时将看到外观如何。

3HierarchyView-thisisalistofallgameobjectscurrentlyinthescene.层次视图(面板)--场景里所有当前游戏对象的列表(清单)

4ProjectView-thisviewshowsallassetsthatareavailableforuse(likeapalette)项目视图(面板)--这个视图显示被应用到的可利用的所有资产(像一个选项板)。

5InspectorView-thisshowsthepropertiesofthecurrentlyselectedgameobject.检视视图(面板,翻译成属性监视器比较合适)--它显示当前选取的游戏对象的属性。

3.Findinggameobjectsin3Dspace在3D空间查找游戏对象

-StartUnity.We’llbeginbycreatinganewproject.

启动Unity,我们将通过创建一个新的项目开始。

-SelectFile->

NewProjectfromthemainmenuandgivetheprojectanamesuchas“GUITutorial”andclickCreateProject.Unitywillnowimportassets(e.g.audio,textures,3Dmodels)sotheyareavailableforuse.

从主菜单选择File->

NewProject(文件->

新项目)并给项目一个名称例如“GUITutorial”然后点击创建项目。

Unity将引入资产(例如音频、纹理、3D模型),以便它们成为使用可利用的。

Onceimportingiscompleteyouwillbepresentedwithyourgameworld.AtpresenttheworldonlycontainsaMainCamera(thisisdefault),youcanseethislistedastheonlyitemintheHierarchyview.

你一旦引入完成,在你的游戏世界将被呈现。

目前,这个(游戏)世界仅包含一个主摄像机(这是默认的),你可以查看作为仅有的项目这个清单,在层次视图里。

-Ifyoucan’tseethecamerainyourSceneView,clickontheMainCameraintheHierarchyView,moveyourcursorsothatit’sinsidetheSceneView,thentypeF(frameselect)onthekeyboard.TheMainCamerashouldnowbeatthecentreoftheSceneView.Thistechniquecanbeusedtofindanygameobject.

如果你在你的场景视图里不能看到这个摄像机,在层次视图里点击主摄像机,移动你的鼠标以至它是在场景视图里,然后在键盘上按F键(帧选择)。

主摄像机现在应该在场景视图的中央。

-AnygameobjectcanbeselectedbyeitherclickingonitintheSceneVieworselectingitintheHierarchyView.IfyouclickonanobjectintheSceneView,youcanconfirmthatyou’veselectedthecorrectobjectasitwillalsobehighlightedintheHierarchyview.

任意的游戏对象可以被选取通过任一方法,在场景视图点击它或在层次视图里选取它

Let’saddsomegameobjectstoourworld.

让我们添加一些游戏对象到我们的世界。

-SelectGameObject->

CreateOther->

Plane,thiswillcreateaplane(a2Dsurface)toallowourcharactertowalkon.

选择GameObject->

Plane,这将创建一个平面(一个2D表面),允许我们的角色在上面行走。

-AddacubetothegameworldbyselectingGameObject->

Cube.

添加一个方块对到游戏世界通过选择GameObject->

Cube.

-AddapointlightbyselectingGameObject->

PointLight.

添加一个点光源通过GameObject->

PointLight.

Youcanlookaroundyour3Dobjectsfromanyanglebyusingthefollowing:

你可以在任意角度(角落)查看你的3D对象通过使用下列的方法:

1.Rotating(Option+LMB)旋转(Option+鼠标左键)

2.Panning(Option+MMB)平移(Option+鼠标中键)

3.Zooming(Option+RMB)缩放(Option+鼠标右键)

NB:

TheOptionkeyisbesidetheCommandkey(theonewiththeApplelogoonit)ontheMackeyboard,L/M/RMBisLeft/Middle/RightMouseButton.Itisrecommendedthatyouhavea3buttonmouse.

选项键是在MAC键盘上Command旁边(上面带苹果标志的键),L/M/RMB是左/中/右鼠标按钮。

强烈建议你有一个3按钮的鼠标。

(以上苹果机器上的操作,下面的说明可以在windows平台上使用)

Ifyouonlyhaveaone-buttonmouse,orareusingalaptop,youcanstillnavigateeasily.Firstly,clickonthehand-shapedtoolintheupperlefthandcorneroftheUnityGUI,thenthefollowingcanbeused:

如果你只有一个按钮的鼠标(注:

我没有见过这样的鼠标)或使用一个膝上型电脑(笔记本电脑),你可以仍旧容易的定位。

首先,在UnityGUI(图形用户界面)的左上角工具栏里点击手型按钮,然后使用下面的说明:

1.Rotating(Option+LMB)旋转(Option+鼠标左键)(在windows上按Alt+鼠标左键)

2.Panning(LMB)平移(鼠标左键)

3.Zooming(Command+LMB)-Trythisnow.缩放(Command+鼠标左键)(在windows上按windows旗标键+鼠标左键,或使用鼠标的滚轮,或先按R键,点击辅助工具(GIZMO)进行缩放),现在尝试。

6.Movinggameobjects移动游戏对象

Youcanpositionanygameobjectin3Dspacebyusingoneofthefollowing:

你可以在3D空间定位任意游戏对象,通过使用下列之一。

1.Movetool(Wonthekeyboard).SelectinganygameobjectthentypingWwilldisplaythreearrowheads,oneforeachaxisof3Dspace.Redisthex-axis,greenisthey-axis,blueisthez-axis,i.e.r,g,b,mapstox,y,z.Tomoveanobject,clicktheLMBonthearrowheadthatrepresentstheaxisyouwanttomoveinandmovethemouseasmuchasappropriate.Asyoudragthearrowheadsnoticetheobject’spositionvaluesintheInspectorPanelchangealso.Youcanentervaluesdirectlyintotheseboxesalso(3boxes,1eachforx,y,zvalues).

移动工具(在键盘上按W键)。

选取任意游戏对象然后按W键,将显示三个箭头,一个3D空间轴的每个轴。

红色是X轴,绿色是Y轴,蓝色是Z轴,也就是RGB映射到X,Y,Z。

去移动一个对象,在箭头上鼠标左键点击表示这个轴你想去移动并恰当的移东鼠标。

当你拖动箭头,注意在检视面板里这个对象的坐标值也改变。

你也可以直接键入值到这些框中(3个框,1个框是各自的x,y,z值)。

Youcanalsore-positionagameobjectbyfirstlyclickingonit,thenmovethecameratopointtowardsthegeneraldirectionofwherethewanttheobjecttomoveto,thenselectGameObject->

AlignwithView.Theselectedgameobjectwillmovetowherethecameranowpoints.

你也可以重新配置一个游戏对象通过第一个单击,然后移动摄像机去朝向对象移动到希望地方的大体方向。

然后选择GameObject->

AlignwithView.(游戏对象->

对齐视图),选取的游戏对象将移动到摄像机新坐标的地方。

2.Rotatetool(Eonthekeyboard).SelectinganygameobjectthentypingEwilldisplaytherotatetool.Torotatearoundanaxis,clicktheLMBontheaxisofchoicethenmovethemousetorotatethegameobject.Asyourotatetheobjectnoticetheobject’srotationvaluesintheInspectorPanelchangealso.Youcanentervaluesdirectlyintotheseboxesalso.

旋转工具(在键盘上按E键)。

选取任意游戏对象然后按E键将显示缩放工具。

围绕一个轴旋转,在选择的轴上按鼠标左键然后移动鼠标去旋转游戏对象。

在你旋转对象注意在检视面板里该对象的旋转值也改变。

你也可以直接键入值到这些框中。

-Let’stryasmallexercise.Movethecube(movetool)sothatitisoutsideoftheSceneView.UsetheFrameSelectfeature(clickCubeintheHierarchyViewthenpresstheFkey)tofindthecubeagain.Finallymovethecubebacksoit’sclosetotheplane.

让我们做一个小练习。

移动方块(移动工具)致使它处于场景视图的外面。

使用帧选择特性(在层次视图(面板)里点击方块,然后按F键)重新找到这个方块。

最后,向后移动方块使它接近于平板。

-Movethepointlightsothatit’sabovethecubeandtheplane.移动点光源使它处于方块和平板的上方。

TheGameViewshowshowthegamewilllookwhenrun(completewithtextures,lightingetc).IfyoucannotseeyourgameworldintheGameView,it’sbecauseyourcameraisnotlookingintherightdirection.

游戏视图显示当游戏运行时外观如何(连通纹理、灯光等)。

如果在游戏视图里,你不能看到你的游戏世界,是因为你的摄像机不在正确的方向探测。

-ClickontheMainCamera,youwillnoticeaninvertedyellowpyramidwireframecomingoutfromit.Thisisknownasthecamera’sviewport(whatitcansee).Iftheviewportisnotpointinginthedirectionofyourgameobjects,navigateinthesceneviewsothatyouarelookingatyourgameobjects,selecttheMainCamerathenselectGameObject->

AlignWithView.YourGameViewshouldnowmatchyourSceneView.

在主摄像机上点击,你将注意到一个倒置的黄色倒置的金字塔线框出现。

这是摄像机的视口(它看到的程度)。

如果视口没有指向你的游戏对象的方向,在场景视图里定位它使你看到你的游戏对象,选取主摄像机然后选取GameObject->

AlignWithView(游戏对象->

对齐视图)。

你的游戏窗口现在应该匹配你的场景视图。

Youcanalsomanuallyadjustyourcamera’ssettingsbyeitherusingthemoveandrotatetools,orchangingitstransformvaluesintheInspectorView.

你也可以手工调整你的摄像机的设置,通过任一的:

使用移动和旋转工具或在检视视图(面板)里更改它的变换值。

Youmayalsowanttomoveyourlighttogivebetteraesthetics.

你也同样应该移动你的灯光以提供更佳的美感。

ToresizeanobjectfirstlyselectitthenpressRonthekeyboard(resizeorscaletool).Youcanvisuallyscaleanobjectbydraggingthesquareblockattheendoftheeachaxis,orusetheInspectorViewtotypeaprecisevaluein.

伸缩一个游戏对象首先选取它然后在键盘上按R键(调整大小或缩放工具)。

你可以直观的缩放一个对象通过拖动每个轴末端的四方块,或使用检视器视图(面板)去键入一个精确值。

We’llnowresizesomeobjectsinourgameworld.

我们现在将伸缩一些对象在我们的游戏世界里。

-Selecttheplaneandsetitsxandzscalevaluesto10intheInspectorview(thefirstandthirdbox,asthesecondboxisfortheyvalue).

选取平板并设置它的X和Z刻度值为10在检视器视图里。

(第一个和第三个方框,对于第二个方框是Y的值)。

-Selectthecube,resizeitalongthey-axisvisually(pressRanddragthegreensquareupward

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 其它模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1