最简单的跟随.
将摄像机挂载到主角人物上即可.
FollowTarget脚本
- 在Unity AssetStore 搜索 Standard, 该资源为免费资源;
- 下载并导入
- Standard Assets/Unity/FollowTarget脚本添加到摄像机
- 将主角主物拖到FollowTarget脚本组件中的Target属性.
SmoothFollow脚本
- 在Unity AssetStore 搜索 Standard, 该资源为免费资源;
- 下载并导入
- Standard Assets/Unity/SmoothFollow脚本添加到摄像机
- 将主角主物拖到SmoothFollow脚本组件中的Target属性.
Cinemachine 组件(2D推荐)
- 在Unity AssetStore 搜索 Cinemachine, 该资源为免费资源;
- 下载并导入
- 这时工具栏会出现Cinemachine选项, 如下图:
- 选择图中Create 2D Camera 选项.
属性介绍