godot
godot copied to clipboard
Move Godot Physics 2D into a module; add dummy 2D physics server
- Production edit: 2D counterpart of https://github.com/godotengine/godot/pull/95252.
If the module is enabled (default), 2D physics works as it did before this PR.
If the module is disabled and no other 2D physics server is registered (via a module or GDExtension), then Godot falls back to a dummy implementation which effectively disables 2D physics functionality (and a warning is printed).
To try it, compile with the SCons option module_godot_physics_2d_enabled=no
.
This is useful for games that want to use a different 2D physics server, especially in web builds where binary size matters.
Linux binary size comparison (scons target=template_release production=yes use_llvm=yes linker=lld
):
- Before (with Godot Physics 2D): 70.512 MiB (73936320 bytes)
- After (with only dummy 2D physics server): 68.821 MiB (72163512 bytes).
So the binary size of the Godot Physics 2D module is 1.691 MiB (1772680 bytes), nice.