今天想到碰撞体,便随手查了一下性能,发现一篇不错的帖子就翻译过来了。以下是译文:
我决定放一些测试数据上来。
Well I decided to post some results from some testing.
所有测试均完成于INTEL二核的3GH处理器,无渲染部分,仅仅是物理部分。
All tests were done on an intel core2duo 3ghz imac with no rendering, just physics.
静态碰撞体几乎没有什么性能开销,高达6万多个不同的碰撞体对性能的影响在一帧之内(<3ms)几乎可以让人忽略不算。
Static colliders seem to have such a minimal impact on performance, Upto 60,000 and beyond of all different colliders were causing no noticable effect on the frame time (<3ms)
所以我尝试去测试动态碰撞体,这会更加有挑战性。
So I tried testing dynamic colliders instead, much more challenging.
要记住这只是物理部分,你的渲染部分的瓶颈只能达到2500个独立模型物体。
Remember this is just physics, your renderer would bottleneck way before reaching 2500 individual objects.
动态测试数据:
Dynamic Tests:
500 Colliders
Capsule 2.1ms
Box 2.6ms
Sphere 2ms
1000 Colliders
Capsule 5.6ms
Box 5.8ms
Sphere 2.9ms
1500 Colliders
Capsule 16.1ms
Box 20.5ms
Sphere 4.8ms
2500 Colliders
Capsule 453-481ms
Box 490-520ms
Sphere 190-233ms
看到了吧?通过这些数据,我们能发现,capsule collider性能要稍稍优越于 box collider ,但是sphere collider的性能明显要甩掉所有人九条街。
So there you have it, across the board capsule actually beats box but not by a huge amount, and sphere obviously kicks everyones ass.
原帖子地址:
http://forum.unity3d.com/threads/34254-Capsule-vs-Box-Colliders
转载自: