查看: 2568|回复: 9
打印 上一主题 下一主题

[提问] 角色的移动1.1---射击游戏系列教程之一

[复制链接]

5552

主题

2

听众

8万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
11

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2011-11-19 11:25:00 |只看该作者 |倒序浏览


           主要实现了角色的自由行走移动。下面为英文原文及简单翻译。
         

           First things first, we need a character which moves around! Create an empty Unity 3D game project
           

           that imports none of the unity packages which comes with the software.
         

           首先,我们需要一个可以自由活动的角色。第一步当然需要创建一个空的unity3d项目了,创建时不要导入任何的资源包。
           

           Open Unity > Goto > File > New Project > Name it 'EVAC-CITY tutorial'.
           

           If you don't have it already go ahead and download the free resources needed for this tutorial here:
           

           Download tutorial resources
           

           Download the Example Projects
           

           Then Open up the Unity project you have just created goto the assets folder and drag the Tutorial
           

           Resouces folder you had downloaded and drag it into the assets folder.
           

           Once this is done you can now save the scene Goto > File > Save Scene As...
           

           Scene.
         

           将所创建的项目命名为EVAC-CITY tutorial,所需项目素材在附件中,然后将所需的资源文件拖至项目assets目录下。当然,自己制作也可以。
         



           Firstly I'm going to create an empty game object and name it 'Player', to rename an object left click
           

           over the name of the object in your Hierarchy and keep your mouse stationary over the object after
           

           releasing left click for a second.. Then from the menu with your new game object selected, choose
           

           (component – mesh – mesh filter), and (component – mesh – mesh renderer). In the mesh filter I am
           

           going to select 'plane' which is made available from adding the above .fbx file to your assets folder.
           

           Also, select 'plane' from your project window, in the inspector look at the FBX importer component, set
           

           the scale factor to 1 and click apply.
         

           首先,创建一个空的物体,并命名为“Player”,选择此物体,并为其添加"mesh filter","mesh renderer" 组件。将mesh filter的mesh属性指定为刚“plan”网格。然后在项目窗口下选择"plane"物体,在其fbx导入设置中,将缩放因子改为1。
           

           Now we need a material to render our character onto the plane! You might have noticed that when you
           

           import an fbx file it automatically creates a material for you. I'm just going to delete what it creates
           

           and create my own and name it 'PlayerMaterial'. Right click the project window and create a new
           

           material. Select the PlayerSpriteSheet.png that you downloaded above and use it as a texture for your
           

           new material. Select (transparent-diffuse) as the shader for your material.
           

           Now in your player object's mesh renderer, select your PlayerMaterial in the materials tab. You should
           

           now see what is displayed in the image on the next page:
           

           接下来 ,为我们的角色(即平面)指定一个材质,你可能已发现,unity3d在导入fbx文件时,会自动创建一个材质,在此将自动创建的材质删除并手动创建一个新的材质赋予角色,将此材质命名为"layerMaterial",将其shader指定为transparent-diffuse,并指定其贴图为PlayerSpriteSheet.png。
           

           Okay our player is being rendered onto our plane! Now let's make sure he's tiled correctly. Select your
           

           PlayerMaterial and set your X tiling to -0.2 and your Y tiling to -0.25. We are going to animate our
           

           character by changing the tiling of the character dynamically over time! I set the Y tiling to -0.25 for
           

           mathematical reasons, in the next tutorial we shall cover animation and if this is not set to a negative
           

           value the animation wont run properly because of the way I have set up calculating which animation to
           

           play. And set the X tiling to -0.2, I have no idea why it's a negative value I must have had a reason a
           

           while ago when I wrote the animation code but the code likes it to be that way and I'm going to trust it.
           

           Next add to your player (component – physics – rigidbody) and (component – physics – capsule
           

           collider) the capsule collider adds a collision object to our player, this collision object will collide with
           

           other collision objects in our world. The rigidbody gives our player a physics based movement to our
           

           capsule collider, this is allows our collider to move around, push and interact with other objects in our
           

           game world.
         

           现在我们的角色已经出现在场景中平面物体上,选择角色材质,将贴图的XYtiling分别设置为-0.2和-0.25
         
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

   

671

主题

1

听众

3247

积分

中级设计师

Rank: 5Rank: 5

纳金币
324742
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2012-2-4 23:30:37 |只看该作者
佩服,好多阿 ,哈哈
回复

使用道具 举报

tc    

5089

主题

1

听众

33万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

板凳
发表于 2012-2-6 23:18:08 |只看该作者
你们都躲开,我来顶
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

地板
发表于 2012-2-12 23:18:09 |只看该作者
楼主收集的可真全哦
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

5#
发表于 2012-4-12 23:25:39 |只看该作者
我看看就走,你们聊!
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

6#
发表于 2012-4-16 23:19:31 |只看该作者
其实楼主所说的这些,俺支很少用!
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

7#
发表于 2012-6-8 23:25:58 |只看该作者
先顶上去,偶要高亮加精鸟!
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

8#
发表于 2012-8-6 00:20:28 |只看该作者
先顶上去,偶要高亮加精鸟!
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

9#
发表于 2012-11-30 23:19:14 |只看该作者
心中有爱,爱咋咋地
回复

使用道具 举报

5969

主题

1

听众

39万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

10#
发表于 2013-2-28 23:32:31 |只看该作者
呵呵,真得不错哦!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

关闭

站长推荐上一条 /1 下一条

手机版|纳金网 ( 闽ICP备08008928号

GMT+8, 2024-5-21 23:49 , Processed in 0.090107 second(s), 30 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部