Move Godot Physics 2D into a module; add dummy 2D physics server
If the module is enabled (default), 2D physics works as it did before. If the module is disabled and no other 2D physics server is registered (via a module or GDExtension), then we fall back to a dummy implementation which effectively disables 2D physics functionality (and a warning is printed). The dummy 2D physics server can also be selected explicitly, in which case no warning is printed.
This commit is contained in:
parent
4254946de9
commit
7c4c4b9987
47 changed files with 497 additions and 29 deletions
|
|
@ -174,6 +174,7 @@
|
|||
#include "servers/navigation_server_3d.h"
|
||||
#endif // _3D_DISABLED
|
||||
#include "servers/physics_server_2d.h"
|
||||
#include "servers/physics_server_2d_dummy.h"
|
||||
#ifndef _3D_DISABLED
|
||||
#include "servers/physics_server_3d.h"
|
||||
#include "servers/physics_server_3d_dummy.h"
|
||||
|
|
@ -298,6 +299,9 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
|||
#endif // _3D_DISABLED
|
||||
|
||||
physics_server_2d = PhysicsServer2DManager::get_singleton()->new_default_server();
|
||||
if (!physics_server_2d) {
|
||||
physics_server_2d = memnew(PhysicsServer2DDummy);
|
||||
}
|
||||
physics_server_2d->init();
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue