Skip to content

Broadphase rebuild #139

Answered by jrouwe
jankrassnigg asked this question in Q&A
Apr 21, 2022 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

If you add bodies one at a time, the resulting tree will look like this (this was made by defining JPH_DUMP_BROADPHASE_TREE and then running FunnelTest):

After the PhysicsSystem::Update / OptimizeBroadPhase it will become a properly balanced tree:

So it's not an issue if you add 1 body at a time during initial load if you call OptimizeBroadPhase at the end (although, if you had added all bodies as a batch you wouldn't need to call OptimizeBroadPhase).

It becomes a bigger problem if your game supports streaming and you need to add 1000s of bodies while the game is running. Calling OptimizeBroadPhase is not an option there (because you'll drop a frame) so collision queries and the physics…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jankrassnigg
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jankrassnigg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #138 on April 21, 2022 16:20.