Freeze when activting GameObject with convex mesh collider.

Hi,

I’ve a problem for a long time. In my game you fly a racing spaceship. I load the prefab when the game is loading and set it inactive. If the player select a ship I set the selected spaceship to active and have a 0.5 - 1 second freeze in the game. The reason for that is the convex mesh collider attached to the ship. If the collider is deactivated there is no freeze. Has anyone a solution how to fix this? Is it possible to activate a game object in a background thread?

Best regards

How complicated is this mesh collider? Mesh colliders are not fast by nature, and their cost scales with their complexity.

It’s a good idea to try and simplify the collision geometry as much as possible.

The collider is not very complex as you can see in the picture, but the mesh has 38571 verts. I thinks that is the reason for the freeze.

Is that necessary? That’s a lot of verts for something with relatively so little detail.

Have you determined that it’s the mesh that’s causing the problem? What happens if you make the spaceship just a simple cube or something. The problem goes away?

Not yet, but I will check it out.
I reply here when the test is done.
Thanks for your help.

I’ve testet it now. It is the mesh itself not the collider. :frowning:

Yeah 38k verts is a ton of verts for one object. Your ship should be as low poly as possible without losing fidelity. This can often be achieved by baking the normals and detail of the original high poly onto a lower poly model.

Ok, thanks for your help. :slight_smile: