漫游

来源:互联网 发布:mhp3数据库下载 编辑:程序博客网 时间:2024/04/27 11:12

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

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


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);

0 0
原创粉丝点击