Trying to optimize my game because of jumpy framerate, from Unity3D profiler, I’ve realized some game objects generated this message “Bake Scaled Mesh Physx Collision Data” which spent quite a lot of CPU time (about 10~15ms)!
This leads to a serious performance problem for my game.
After some investigation, I found from Unity3D forum this was cause by “Having an object with a mesh collider scaled at something other than <1, 1, 1>“.
WOOHOO! This is easy to fix right?! Just check all game objects with collider attached and make sure the scaled is <1, 1, 1> and done!!
Some more tips!
- Moving a static marked collision mesh would cause physx to recalculate it every single frame (which should only be a precalculate step)
- Also ensure to not move around mesh collider objects that aren’t convex marked, as such mesh collider objects are not meant to move at all, the whole collision tree for object and world in that sector need to be updated all the time which is extremely cpu intense.