- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
- 纳金币
- -1
- 精华
- 11
|
很不错的一篇英文教程,还算易读。主要讲解如何制作一个第三人称角色控制功能,比较常用也比较实用的一个功能。
In this tutorial for the Unity game engine we will be learning how to create a 3rd person character controller. For new Unity developers, the question of how to create a working 3rd person controller is possibly one of the most asked questions out there.
While there are a number of guides out there many new developers feel that they are difficult to understand, difficult to follow and awkward to use in practice, this is because they are either tied into a full game case study and therefore contain a lot of game specific code, are over complicated and aren't designed to be taken as a controller framework.
So we've attempted to fill that void by creating this 3rd person controller tutorial which will take you through the steps required to implement a functional 3rd person controller which is complete enough to be useful but simple enough to be easy to follow and extended to meet your games requirements.
The bottom line is, 3rd person controllers are actually very simple to implement but are made difficult due to the lack of documentation with a reasonable point of entry.
Before we Begin
Before we begin this tutorial you will need a character with at least three animation cycles, don't worry if you don't have one as we've supplied one below. If you want to use your own then you'll need three animation cycles:
1. An idle cycle (so standing still)
2. A walk cycle
3. A***n cycle
If you have a character and want to use it then make sure you have at least those three animations. Also if your using a Biped Rig created in 3D Studio Max then make sure the Pelvis is named "rootJoint" as Unity looks for that joint as the root.
相关开始项目文件会在U吧资源频道提供,当然,你也可以自己准备初始素材文件!
Create the Project and Scene
Once you have a character, either our test character or your own, then we're ready to go. Naturally before we***n off and create a controllable character we'll need to setup some kind of a game level for the character to walk around. So follow these steps:
1. Create a new project by going to "File -> New Project". You don't need any of the asset packages for this tutorial but we're including the standard asset package anyway so we can grab the sky box and some terrain textures.
2. When the blank project is loaded up we will want to create our scene which will contain a textured terrain, a sky box and a directional light, so:
- First create a terrain by going to "Terrain -> Create Terrain".
- Second create a directional light by going to "GameObject -> Create Other -> Directional Light", then move it upwards and rotate it down so its shining down onto the terrain.
- Now select the Terrain in the Hierarchy then select Paint Terrain Texture button in the Inspector and add a default texture
- Finally go to "Edit -> Render Settings", then in the Inspector set the Skybox Material to one of the sky boxes (i.e. blue sky or sunset)
You should then have a very basic level like the one pictured below.
Importing the Character
Now we need to import our character into the project, so in the Project Panel, right click and select "Import New Asset". When the dialogue appears, find your character and import it.
Depending on the character it may take a short while to import, but when its in you should see the characters prefab in the Project panel.
If you are using your own character which has textures then you will want to import the textures and assign them to the model as well. Details on how to do this are contained in the Character Setup tutorial linked in the introduction above.
So lets continue, in part 2 we will setup the animation cycles and input settings.
由 u8 发表 |
|