漫游

现在要做的事情是人在场景中漫游,碰到障碍物时,不能前行。碰到楼梯要爬。

就这么简单的东西,貌似很常见的功能,我搞了好几天了,好像不太容易实现。开始拼命了!


How to make a simple first person walkthrough

Here's how you can make a simple first person walk-through with your own artwork:

  1. Import your level. See here on how to import geometry from your art package into Unity.
  2. Select the imported model file and enable Generate Colliders in the Import Settings in the Inspector.
  3. Locate the Standard Assets->Prefabs->First Person Controller in the Project View and drag it into the Scene View.
  4. Make sure that the scale of your level is correct. The First Person Controller is exactly 2 meters high, so if your level doesn't fit the size of the controller, you should adjust the scale of the level size within your modeling application. Getting scale right is critical for physical simulation, and other reasons documented at the bottom ofthis page. Using the wrong scale can make objects feel like they are floating or too heavy. If you can't change the scale in your modeling app, you can change the scale in the Import Settings... of the model file.
  5. Move the First Person Controller to be at the start location using the Transform handles. It is critical that the first person controller does not intersect any level geometry, when starting the game (otherwise it will be stuck!).
  6. Remove the default camera "Main Camera" in the hierarchy view. The First person controller already has its own camera.
  7. Hit Play to walk around in your own level.

2014-05-13-07:42
unity提供了现成的package,可以实现CounterStrike中First Person的效果,

现在需要解决的是抛开unity集成开发环境完全用script实现。

先从理论入手,它是怎样加载component的,

我需要怎样加载?


5-13-16:01

现在的问题 已经简单到:把一个prefab通过assetBundle加载进来。

16:23  Yes 出来了

先弄成assetBundle,再用www加载,出来啦,爽!

BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath("Assets/Standard Assets/Character Controllers/First Person Controller.prefab"),
null, "Assets/Resources/FirstPersonController.unity3d", BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets);

url="file:///E:/danny/nnn/qqf/Assets/Resources/FirstPersonController.unity3d";
WWW www2 = WWW.LoadFromCacheOrDownload(url, 1);

Instantiate(www2.assetBundle.mainAsset,transform.position,Quaternion.identity);

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值