bullet async collision shape loading

I’m currently working on my first “big” panda3d project, a loading system for large terrain.
The terrain is currently loadet from precomputed bam files, as this seems to be the fastest way to load them.
However, as I want to make use of Bullet physics for Character movement, I need the Collision Shapes representing the terrain. Currently, I loop through all Vertices of the terrain model and feed them into a collisionMesh, using this method:

def getCollider(n):
	for np in alln:

			for i in range(geomNode.getNumGeoms()):
		except:print (geomNode)
	meshS = BulletTriangleMeshShape(mesh, dynamic=False) 
	node = BulletRigidBodyNode()

	return node

As this approach is very slow (I have no Idea about how to port this function to C++), i use a seperate thread for generation of the collision mesh, while running bulletworld.doPhysics in the main thread.
However, every time i generate such a mesh, Bullet.doPhysics stucks until mesh generation is complete, even if I don’t call attachRigidBody
So, as far as I understand, the generation of the bullet mesh seems to somehow block world.doPhysics, resulting in heavy lag.

Note that the game jumps back to 60fps after the collision mesh is loaded.

  1. is there any fast way to load large bullet collision shapes (e.g. serializing using pickle) or collision models?
  2. Any Idea why bulletworld.doPhysics is slowed down (or paused, i don’t know) while i generate the bullet mesh?

I just found that the bam model contains a single geom, having 129*129 vertices
perhaps I just need to split them into smaller geoms…
I’ll try.

2nd update:
splitting into smaller geoms doesn’t work, as i scale the rigidbody (I experienced some strange behaviour when directly using the .bam file generated from GeoMipTerrain )
Can anyone please give me an example of how to load bullet triangle meshes in a worker thread WITHOUT blocking the main thread?
Help pls

i found that addGeom() is somehow slowing down the main thread rapidly, if i use addTriangle(), i dont have any problems (even if i call addTriangle 100000 times…)