Fork me on GitHub

Optimizing Performance in iOS Part2:Optimizing Physics Performance

Optimizing Physics Performance

Unity has the next-generation NVIDIA PhysX physics engine built-in. This allows for unique emergent behaviour. But you should not forget that iOS is an OS designed for mobile devices and has its own performance limits which can be very easily reached. The following are high level tips for how to tune physics to get optimal performance on the iOS:

  • Keep Fixed Timestep in Time manager high enough to save cpu cycles, but still low enough to run physics smoothly.
  • Set Maximum Allowed Timestep in Time manager to 8-10fps to cap the time spent on physics in the worst case scenario.
  • Use colliders with great care. Some of them (like mesh collider) are very expensive while some (like sphere collider) are quite cheap. This list enumerates colliders in order of growing performance penalty:
    • Sphere collider (cheap)
    • Box collider
    • Capsule collider
    • Mesh collider
    • Wheel collider (expensive)

The total amount of physics calculations depends on the number of non-sleeping rigid bodies and colliders in the scene and the complexity of the colliders. Try to minimize these numbers and track what impact it has on physics calculation time. Track these statistics with internal profiler.

posted on 2012-02-07 08:49  pengyingh  阅读(242)  评论(0编辑  收藏  举报

导航