- Building an FPS Game with Unity
- John P. Doran
- 354字
- 2021-07-09 21:09:49
Setting up a testbed
Now, before we get started, let's create an area that we can use to test our new weapons.
- Open up the project and a scene for us to work with. We can create a new level but, in this instance, UFPS comes with a nice scene for us to start with. From the Project tab, go to the
UFPS/Base/Content/Levels/CleanScene
folder and double-click on the CleanScene file.This scene (or level) is a simple terrain with a basic first-person camera and controller intended for prototyping, which is perfect for us, except we want our player to be already set up. To do this, we will remove this simple camera and replace it with a built-in one.
- From the Hierarchy tab, select the Camera object by clicking on it and delete it by pressing the Delete key.
- Next, go to the
UFPS/Base/Content/Prefabs/Players
folder and drag and drop an AdvancedPlayer prefab into your game world. To see the object, double-click on it in Hierarchy (or press the F hotkey with it selected) and it'll zoom directly to its position. - You may notice that there are quite a few things attached to this player, but the most important thing to notice right now is the light green capsule shape, or half capsule shape, depending on how it's positioned. Move this object up on the Y axis until the entire capsule is above the ground plane by grabbing on to the green arrow and dragging it upward. (If you do not see the arrows, press the W hotkey to select the Translation tool. Alternatively, you can set the Transform component's Position Y property to
-7
using Inspector.) - Now, click on the Play button. You should note that we can now control a player.
If you press keys from 1 to 4, you should be able to shoot using various weapons.
Here are the various other controls you can use:

推薦閱讀
- Qt 5 and OpenCV 4 Computer Vision Projects
- ASP.NET Web API:Build RESTful web applications and services on the .NET framework
- 自己動手寫搜索引擎
- 編程的修煉
- 無代碼編程:用云表搭建企業數字化管理平臺
- Amazon S3 Cookbook
- Visual C++數字圖像處理技術詳解
- Mastering Google App Engine
- Python機器學習算法: 原理、實現與案例
- Visual Studio Code 權威指南
- 從零開始構建深度前饋神經網絡:Python+TensorFlow 2.x
- Beginning C# 7 Hands-On:The Core Language
- Koa與Node.js開發實戰
- C語言編程魔法書:基于C11標準
- 程序員面試金典(第6版)