Physics performance with terrain

Hi all,

In my game I have a regular mesh as underground. It’s static geometry and irregular. So I am using CollisionShapeFactory.createMeshShape() to create a physics object. I now notice that as soon as my player capsule hits that mesh (i.e. is on the ground) performance goes down considerably. As soon as I fly in the air my FPS goes up a factor 5 to 6. The terrain is rather high-poly and very irregular (it represents a ruined building with tons of debris on the floor). Is there a way that I can optimize this? What are general tips on performance for this kind of thing?


1 Like

Can it be represented by a HeightfieldCollisionShape?

No it’s not a heightfield at all. It has overhangs and stuff like that

You could try to simplify the mesh in Blender, export it as a separate object and load that one to create the collision shape.

1 Like

That is main problem with your performance. You want low-poly models wherever possible.

I know low-poly models don’t look as good, and that’s certainly true when the model is all alone in Blender, but in game you might find that you won’t notice low-poly except on careful inspection.

Turning a hi-poly into a low-poly model is simply deleting verticies and edges. There are many youtube videos on turning models into game-ready assets.

Yes but for rendering it’s fine. So I think I’m going to try simplified meshes for collision detection alone

1 Like

Maybe try with V-HACD collision shape generation to make a simplified shape for the whole scene.

or with hull shape generation


By the way this wiki may help you by choosing the right collision shapes.


The MeshCollisionShape constructor has an option to use quantized AABB compression, which is enabled by default. Have you tried disabling it?

Also, if you’re not using Minie, you should try it.

I think I’m going to try simplified meshes for collision detection alone

That seems wise. Meshes used for rendering/visualization usually have far more triangles than are needed for collision detection. Just as you use a capsule for the player, you should use a simplified mesh for the underground. Think of it as an extra level of detail that’s never rendered.