Thought I’d share something I was working on in my pet project:
I’m using a dynamic terrain that moves and generates with the camera. Since the terrain is always changing, I can’t use a single collider for the entire terrain (and even if I could, it would be too large and not performant).
Instead, I create a smaller, localized collider around the player’s current position. This collider is based on the vertices of the terrain within a certain diameter of the player.
To avoid the performance cost of creating and disposing the colliders every frame, I only update the colliders when the player approaches the edge of the current one they are on.
By adjusting the diameter of the collider and the threshold for creating a new one, I can control the balance between performance and how much of the scene is able to simulate physics.
In the video below, the first train car acts as the player that determines the collider position.
Let me know if you’d like more details on the implementation, and I can maybe clean up the code and make a proper blog post about it.