Separate PhysicsSpace/World questions

I got multiple questions, but mostly related to:
big/multi world physics optimizations. [multiplayer] [3d game]

So if there is just totally different approach, answer to this theme.


  1. How can i create new Physics Space (or World if not possible) and switch physics objects between them?

  2. How Godot physics or Jolt check-optimization work?
    As i know bullet physics check “boundings” per collision shape first to know if check it at all.
    But now lets say If i got in One physic space 999999 collision shapes, so do it check first bounding for each 999999 collision shapes or it optimize it somehow and using some optimization check only closest ones?
    Related first question that can optimize this.

  3. What is Godot-physics future?
    I seen there is Jolt, but as i seen it still dont even have cloth physics.
    And anyway do physic-space term exist in both? or in Jolt not?

Please note i know layers/masks but they are used to different things and have limited amount

Viewports contain a World3d, which the I assume the physics server will reference bodies of each world3D separately. To transfer you just need to re-child the nodes under a viewport branch.

There is a broad phase and a narrow phase stages for collision detection. Basically it draws boxes in space based on the AABB size to check if bodies are near enough to each other to investigate further if they are touching.

Use the simple pre-built collision shapes, as the have solvers made in native code. If you have complicated meshes use multiple, simple collision shapes per physics body.

I can’t answer the last thing, but Godot physics needs some help.

1 Like

Thanks, i read that Jolt broad phase is based on QuadTree

So no matter how many AABB-broad-phase checks are there, it should be O(sqrt(n, 4) * 4)

So this 999999 can easly be transformed to 32 * 4 checks.
so no need any additional optimizations here.

Tho as i remember Bullet had problem with AABB broad phase amount

Not sure tho about this Default Godot Physics that is Godot invention.

In any case as i see Jolt should work fine, so would not even need to split into multiple physics spaces or godot-worlds.

Answer for 3. is still unknown tho. I did only read there was request to make Jolt official, but i assume it require time, because Jolt-godot-plugin still require to add many things like cloth physics or multi-thread safe working option.
Maybe someone will tell more in this topic.

Here is the bvh math source code Godot uses.

Comments says it’s based on octotree, googling around quadtree is said to be used mainly by 2d physics engines and 3d typically uses octotree.

fyi bullet physics was removed due to threading issues, They opted to make physics servers more module via gdextensions.

see this commit:

1 Like