ADM-201 dump PMP dumps pdf SSCP exam materials CBAP exam sample questions

Unity 5 官方教程 #1 – 配置开发环境 – 译学馆
未登录,请登录后再发表信息
最新评论 (0)
播放视频

Unity 5 官方教程 #1 - 配置开发环境

Unity 5 - Roll a Ball game - 1 of 8: Setting up the Game - Unity Official Tutorials

Let’s begin by creating a new project.
让我们从新建一个项目开始吧
We can create a new project from File > New Project…
我们可以通过File>New Project选项新建项目
This will bring up the home screen.
然后将会打开一个主界面
I’m going to call the new project “Roll a Ball”.
我要给这个新项目命名为“Roll a Ball”
The next thing we need to do is set the destination,
接下来我们需要设置文件位置
or path to our new project.
也就是我们新项目的路径
I’m going to put this new project on my desktop.
我会把新项目放在桌面
At this point it’s worth noting that we can
在这里需要注意
have our new project use default settings
我们可以把新项目设置为
for either a 2D project or a 3D project.
2D或者3D项目
We will choose 3D.
我们选择3D
And then I will click on “Create Project”
然后就点击“Create Project”
to make a new project.
来开始制作新项目
We now have our new project with a new empty Scene.
现在我们创建好的新项目自带一个空场景
Before creating anything in the new Scene
在我们往这个空场景添加东西之前
we need to save our Scene.
我们需要先保存我们的场景
We can save our Scene by going to File > Save Scene
可以通过选择菜单File>Save Scene
or by using the keyboard shortcut.
也可以使用快捷键来保存
I’m going to save this scene in the Assets directory
我会把这个场景保存在Assets目录下的
in a new folder called “_Scenes”.
名为“_Scenes”的新建文件夹里
The underscore is optional, I use it to sort this
这个下划线不是必要的 它是用于
folder to the top of my Project window.
让这个文件夹显示在我的Project窗体的上端
Now I’m going to call the Scene “MiniGame”.
现在我给这个场景命名为“MiniGame”
We can now see in our “_Scenes” folder
现在可以看到在我们的“_Scenes”文件夹里
the Scene called “MiniGame”.
这个叫“MiniGame”的场景
Let’s create our game board, or play field.
现在来创建我们的游戏面板 或者说游戏区域
To do this we will use a stock Unity Plane.
我们需要用到Unity常备的平板对象
We can create this Plane from either
有两种方式创建平板
GameObject > 3D Object > Plane,
一种是选择菜单GameObject>3D Object>Plane
Or from inside the Hierarchy view using the Create menu.
另一种是使用Hierarchy窗体中的创建菜单
Rename this GameObject “Ground”.
把这个游戏对象重命名为“Ground”
We can do this by either selecting the GameObject
我们可以先选中这个游戏对象
and using the Enter or Return key to allow editing
再使用回车键进入编辑状态
or by clicking on the GameObject twice, slowly.
或者缓慢双击这个游戏对象进行编辑
Type in the new name and hit Enter or Return
输入新名称后按下回车键
to confirm this change.
就可以提交修改
Reset the Transform component
接着重置这个Transform组件
using the context-sensitive gear menu in the upper right.
可以通过右上方的上下文关联的齿轮菜单来重置
This will place the GameObject at the location of
这将会使游戏对象被重新放置在
(0, 0, 0) in our Scene.
我们场景的(0,0,0)坐标上
This point is known as the origin point of the world
我们都知道这个点是世界的原点
and this is where all of the
同时它也是
coordinates in the Scene are calculated from.
场景坐标进行计算的参考点
Now with the GameObject selected and the
现在保持游戏对象的选中状态
cursor over the Scene view, type the F key,
并把鼠标移到Scene视图上 按下F键
or choose Frame Selected from the Edit menu
或者选择Edit菜单里的Frame Selected选项
to see the entire GameObject in the Scene view.
以便查看这个场景试图的游戏对象全貌
Looking at our current Scene,
看看我们当前的场景
we can see grid lines indicating the Plane at origin.
我们可以看到在原点的平板上显示着网格线
For the purposes of this project
考虑到这个项目的目的
we will turn them off.
我们需要隐藏掉它们
Select the Gizmos menu in the Scene view
选择Scene视图的Gizmos菜单
and deselect Show Grid.
然后取消勾选Show Grid选项
We need to change the scale of the ground Plane.
我们需要改变底部平板对象的大小
We can do this in a number of ways:
有很多种方法可以实现
We can use the Scale tool,
我们可以使用大小工具
simply grab the axis handle you want to change
只用鼠标抓住你想改变的坐标轴柄
and drag the handle rescaling the Plane.
然后拖拽轴柄来改变平板的大小
We can click and drag
也可以点击并拖拽
on the title of the fields we want to change.
想要改变的坐标输入框的相应标题
Or we can type a number directly
或者直接在
into the field we want to change.
我们想要调整的坐标输入框内输入数值
You can tab between fields
你可以按tab键在输入框间跳转
and hit Enter or Return to confirm your choice.
然后按下回车键提交你的设置
Now remember a Plane has no volume
现在要注意平板是没有高度的
and scale does not work on the Y-axis.
所以改变Y轴上的大小没有效果
There will be no change unless you go into negative numbers.
除非设置为负数才会有所改变
In this case the Plane,
这种情况下
which is a single-sided object
因为平板是一个单面的物体
will simply face the other direction.
所以它只会面向另一个方向
If you place a Plane in the Scene and you can’t see it
如果你在场景中放置了平板但是看不到
check your orientation between the Plane and the Camera,
那就检查一下平板和镜头的相对方位
and make sure that you have the correct value for the Y-axis of Scale
并确保你设置了合适的Y轴坐标大小
This is usually the value of 1.
通常这个值设置为1
Let’s create our Player object.
现在来创造我们的游戏者对象
In this assignment our Player object will be a Unity Sphere.
在这次任务之中我们的游戏者对象将会是Unity的球体对象
From the Hierarchy > Create menu, select Sphere.
通过打开Hierarchy窗体的Create Menu 选择Sphere
Rename the Sphere “Player”,
把这个球体命名为“Player”
Reset the Transform to make sure it’s at origin.
重置Transform组件确保它位于原点
Select Edit > Frame Selected,
选择Edit>Frame Selected
or use the F key while the cursor is over the Scene view
或者把光标移到Scene视图上按下F键
to focus our Scene view camera on our GameObject.
使我们场景视图的镜头聚焦到我们的游戏对象上
See how the Sphere is buried in the Plane?
看到这个球体有多少被埋进平板了吗?
This is because both GameObjects
这是因为这两个游戏对象
are in the exact same location in the Scene:
在场景中拥有完全一样的坐标位置
the origin point, or (0, 0, 0) on the X, Y and Z-axes.
也就是原点 即XYZ坐标系的(0,0,0)坐标
We need to move the player’s Sphere up
我们需要把游戏者的球体对象上移
until it rests on the Plane.
直到它停留在平板的上方
All Unity primitive objects, Cubes, Spheres, Capsules,
所有Unity的原始对象 包括方块 球体和胶囊体
have a standard size. They are either:
都有标准的大小 它们都是
1 by 1 by 1 or 1 by 2 by 1 Unity units.
1×1×1或者1×2×1个Unity立方单位
As such we simply lift the Player object up
像这样我们只用把游戏者对象上移
by half a unit in the Y-axis,
Y轴上的半个单位
and we know it is laying perfectly on top of Plane.
我们就知道它这时就正好放在平板之上了
If we look in the Game view we can see that
如果我们现在看Game窗体会看到
the Player GameObject is lit
游戏者对象被光照耀着
and it casts a shadow on the Plane.
并且在平板上投下了阴影
All new Unity Scenes come with the default Skybox
所有的Unity场景都默认自带天空盒
and a Directional Light to represent the sun,
和代表太阳的一束平行光
so we don’t need to worry
所以我们不用担心
about setting up any default lighting.
设置默认光照的事
What could be improved however, is the
然而我们需要改进的是
white Player Sphere on the white background.
白色背景上放的也是白色的游戏者球体对象
Let’s add some color to our background
让我们给我们的背景加点颜色
so there is some contrast between the player and the play field.
在游戏者对象和游戏区域之间应该有一些对比
To add color or texture to a model
要给一个模型添加颜色或质地
we need to use a Material.
我们需要用到Material
We won’t go into the details of materials now,
现在我们还不会详细研究材料的细节
and we won’t be using any textures.
我们也还不会用到质地
We will simply use a standard material
我们会简单用一个标准材料
to add color to the objects in our Scene.
来给我们场景的对象添加颜色
First let’s create a new folder
首先我们创建一个新的文件夹
in our project to hold our materials.
用于存放我们项目中的材料
We can do this by using the project’s
我们可以使用这个项目的
Create menu and selecting Folder.
Create菜单并选中Folder
Rename this folder “Materials”.
把文件夹重命名为“Materials”
With the Materials folder selected,
保持Materials文件夹为选中状态
use the project’s Create menu again
再次打开项目的Create菜单
and this time select Material.
这次我们选择Material选项
Note how the material was created in the Materials folder.
注意材料被新增在Materials文件夹中
This is because we had the folder selected
这是因为我们已经选中了这个文件夹
when we chose to create our new material.
在我们创建我们的新材料之前
Rename this material “Background”.
把这个材料重命名为“Background”
Select the material
选中这个材料
and under Main Maps the first property is Albedo.
可以看到在Main Maps之下第一个属性是Albedo
Click on the Albedo’s color field to open a color picker.
点击Albedo的颜色框来打开一个颜色选取器
Change the color to a nice dark shade of blue.
把颜色修改为一个漂亮的深蓝色
In our case I will use the RGB values of 0, 32, 64.
在我这里我会通过设置RGB值为0 32 64来实现
For a preview of the Material
如果想要预览材料
make sure that the preview window is open.
请先确保预览窗体是打开的
To apply the texture to the Plane,
现在把这个材质应用到平板上
simply select the material in the Project view
只需选中Project视图中的相应材料
and drag it on to the Plane in the Scene view.
并把它拖到Scene视图里的平板上
Now the player stands out on the dark blue background.
现在游戏者对象就立在一个深蓝色的背景上了
I want to make one additional change
我还想做一个额外的修改
that will help us later in this project.
便于我们之后的操作
I want to rotate the main Directional Light
我要旋转主平行光的角度
so that we have better lighting on our player.
便于更好地照亮我们的游戏者
Select the Directional Light and in the Transform component
选中Directional Light并在它的Transform组件中
change the Transform Rotation on the Y-axis to 60.
修改Transform的Rotation在Y轴上的角度为60度
This will give better shape to our Player Sphere.
这会让我们的游戏者球体形状更好看
Now we have a Player GameObject and a background play field.
现在我们就拥有了一个游戏者对象和一个游戏区域的背景

发表评论

译制信息
视频概述

新建Unity项目以及初始背景的设置

听录译者

收集自网络

翻译译者

keydew

审核员

审核员1024

视频来源

https://www.youtube.com/watch?v=W_fAidYRGzs

相关推荐