Unity 3D 做FPS游戏

Part 1: Introduction 第一部分 介绍


This tutorial will detail how to make a simple First Person Shooter (FPS). It will introduce fundamental 3D game programming concepts and give tips on how to think like a game programmer.
这个教程将详细介绍如何制作一个简单的第一人称射击(FPS)游戏,它将介绍基本的3D游戏程序概念并且给出一个游戏程序员如何进行思考的提示

Setting up the game environment 安装游戏环境

下载FPS_Tutorial这个例题~里面的资源就都有了。原来英文教程上的废话很多,不过确实很贴心,大家就慢慢看吧。红色的字是我自己写的。


Once the assets have been imported, you’ll notice there are many folders in the Project panel.
一旦资源被导入,你将注意到项目面板上有许多目录


 In the Projects panel, Select the mainLevelMesh from Objects/mainLevelMesh/mainLevelMesh.


在项目面板上,从Objects/mainLevelMesh/mainLevelMesh中选择mainLevelMesh


 In the Inspector panel, inside of the FBXImporter options you’ll find the "Generate
Colliders" option. Toggle that option on. If we don’t do this, the player will
simply fall through the level (no collision).
在检查面板上,有一个FBXImporter选项,你将找到“产生碰撞器”选项,勾选它,如果我们不这样做,游戏者落下时将穿过层面
 Drag the mainLevelMesh into the scene.
拖拽mainLevelMesh到场景中
 

 

我参考的那个网上的翻译文档真的很要命啊!!翻译了那么多的错误。有兴趣的可以百度一下对比看看。

There is no need to add a light to the scene, the level is already fully lightmapped. The
imported level uses lightmaps for all lighting which allows us to use prebaked shadows.
这里不需要给场景增加灯光,这个层面上已经提供了充分的光影,这个导入层使用了允许我们使用prebaked Shadows预焙阴影。
Lightmaps are very good for performance, especially if you want to create a
complex lighting setup.
光照图用起来非常好,尤其是你想建立一个复杂的灯光设置的时候
You’re now ready to add a character into the environment.
你现在准备要给环境中增加一个角色
Adding the Main Character 增加主角

We’re now going to add in a character for the player to control. Unity has a built in
prefab specifically for a firstperson controller. This can be found in the Project panel under Standard Assets>Prefabs.
 To add the First Person Controller, click on the arrow beside Standard Assets in the Project panel, as list of assets will appear. Find the folder called Prefabs and click on the arrow in the left hand side. You should now see the First person controller asset. Drag this into the Scene view.
~~

在新的3.4版本里面已经没有这个第一人称控制器了已经不在这个地方了~~,所以也就不用看英文了,

我是先去创建一个Box~~然后拖拽摄像机到这个box上,成为子物体,然后给Box加上碰撞检测。(实际情况是,我发现这个盒子控制起来真是要命,真相是一个人套在盒子里...)

You should see a cylinder object representing the player, 3 large arrows for altering
the location in 3D space for the object (if you do not see 3 arrows then
press the‘W’key), and a white mesh which shows the object’s viewport (where
it is currently looking). The FPS Controller is now the default camera, by moving
this object, you change the current view in the Game View. You’ll also notice
that the FPS Controller has a camera icon on top of it. Move the character so
that it is above ground level in the environment.

 

今天早上我重新打开了这个项目,发现导入Character Controllers插件包里面是有这个First Person Controller的!~直接拖出来就可以用了。

 

第二部分是武器,没有什么新资源了,下来时需要写代码了。

This intermediate-level tutorial extends upon the Basic FPS tutorial by introducing game elements such as multiple weapons, damage and enemies.
Prerequisites
This tutorial assumes that you are familiar with the Unity interface and basic scripting
concepts. Additionally, you should already be familiar with the concepts discussed in
Part 1 of the FPS tutorial series.
Before we begin -level setup
Download FPS_Tutorial.zip, unzip, and open the project folder in Unity. If you
have completed Part 1, then unzip the files to a new folder.
Import the Standard Assets Unity Package.
Add the mainLevelMesh and FPS controller prefab to the scene.
NOTE In this tutorial no new scripts need to created. We’ll be using the ones that
were downloaded from the Unity Package.
Weapon switching Before we discuss how to create each individual weapon, we need to write some code to manage how the weapons are initialized and switched from one to another. Let’s look at the Javascript for PlayerWeapons.js:

首先是给武器一个位置,我们建立一个空物体,作用是定位子弹从什么地方发射出去。这个难度不大,有一个Unity 3D做坦克大战的教程里面已经写好了如何发射炮弹。

(很抱歉,这个博客没有隐藏功能,写了半截只能放在这里了)

 

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值