iphone - 角色移动时 iOS FPS 低帧率,探查器显示 Physics.Simulate 占用 CPU 时间

标签 iphone ios performance unity-game-engine physics

我们为 iOS 开发 FPS 游戏。玩家角色是标准 Assets (移动)中的第一人称控制。它附有标准角色 Controller 。

我们的场景中有 7 个敌人每个敌人都有一个非运动刚体。当玩家靠近时敌人会向玩家移动

场景有 5500 个三角形/6000 个顶点当玩家不动时,我们在 iPhone 4 上有 20-25 fps。当玩家开始移动时,fps 下降到 7-10。

此外,我们通过直接改变他们的变换来移动敌人,而不是通过调用 AddForce。

在分析器中我们可以看到当玩家移动时 Physics.Simulate 占用了大约 60%-70% 的 cpu。

我们应该如何解决这个问题?

我们是 Unity 和 3D 的新手。对不起我的英语。

最佳答案

根据 Unity 的文档,在 iOS 设备中使用物理引擎会降低性能,因为它严重依赖 float 运算。 http://docs.unity3d.com/Documentation/Manual/iphone-basic.html

为了提高性能,正如文档所建议的那样,避免 Mesh Colliders,设置低固定帧率,并启用 Rigibody Interpolation。

Can I make a game that uses heavy physics? A: Physics can be expensive on iOS is it requires a lot of floating point number crunching. You should completely avoid MeshColliders if at all possible, but they can be used if they are really necessary. To improve performance, use a low fixed framerate using Edit->Time->Fixed Delta Time. A framerate of 10-30 is recommended. Enable rigidbody interpolation to achieve smooth motion while using low physics frame rates. In order to achieve completely fluid framerate without oscillations, it is best to pick fixed deltaTime value based on the average framerate your game is getting on iOS. Either 1:1 or half the frame rate is recommended. For example, if you get 30 fps, you should use 15 or 30 fps for fixed frame rate (0.033 or 0.066)

关于iphone - 角色移动时 iOS FPS 低帧率,探查器显示 Physics.Simulate 占用 CPU 时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15879576/

相关文章:

javascript - 使用 JS 或 CSS 检测 iOS 设备是否有 home bar

java - 加速 IntelliJ-Idea

iphone - 嵌套UIScrollView-iPhone照片应用

iphone - Cocos2d - animationwithframes :delay: deprecated

ios - 确定应用程序是否在 iPhone 6 键盘上以 "scaled"模式运行?

php - Web应用性能测试监控的工具/建议

python - Python 中未使用的导入会影响性能吗?

iphone - 以嵌入式 html 播放视频时,如何使用证书不正确的 https 连接播放视频 URL

ios - iPhone 用户加速度不为零

ios - 我可以假设所有用户在同一 iOS 设备上应用程序速度相同吗