diff --git a/doc/classes/PhysicsServer2D.xml b/doc/classes/PhysicsServer2D.xml index d40326fa2182..9d4b84ea976e 100644 --- a/doc/classes/PhysicsServer2D.xml +++ b/doc/classes/PhysicsServer2D.xml @@ -893,13 +893,6 @@ Creates a 2D separation ray shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the shape's [code]length[/code] and [code]slide_on_slope[/code] properties. - - - - - Activates or deactivates the 2D physics server. If [param active] is [code]false[/code], then the physics server will not do anything in its physics step. - - @@ -983,6 +976,11 @@ + + + If [code]true[/code], the server can be accessed and will update on each physics frame. + + Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated. The default value of this parameter is [member ProjectSettings.physics/2d/solver/contact_recycle_radius]. diff --git a/doc/classes/PhysicsServer2DExtension.xml b/doc/classes/PhysicsServer2DExtension.xml index 41826ea7c2a6..817cfe03de5e 100644 --- a/doc/classes/PhysicsServer2DExtension.xml +++ b/doc/classes/PhysicsServer2DExtension.xml @@ -812,6 +812,12 @@ Overridable version of [PhysicsServer2D]'s internal [code]init[/code] method. + + + + Overridable version of [method PhysicsServer2D.is_active]. + + diff --git a/doc/classes/PhysicsServer3D.xml b/doc/classes/PhysicsServer3D.xml index 4a4a1ad02511..9102b6aa26d5 100644 --- a/doc/classes/PhysicsServer3D.xml +++ b/doc/classes/PhysicsServer3D.xml @@ -973,13 +973,6 @@ - - - - - Activates or deactivates the 3D physics engine. - - @@ -1333,6 +1326,11 @@ + + + If [code]true[/code], the server can be accessed and will update on each physics frame. + + The [Joint3D] is a [PinJoint3D]. diff --git a/doc/classes/PhysicsServer3DExtension.xml b/doc/classes/PhysicsServer3DExtension.xml index e58a7ff9a8aa..21f40817c8b9 100644 --- a/doc/classes/PhysicsServer3DExtension.xml +++ b/doc/classes/PhysicsServer3DExtension.xml @@ -760,6 +760,11 @@ + + + + + diff --git a/servers/extensions/physics_server_2d_extension.cpp b/servers/extensions/physics_server_2d_extension.cpp index f8e78d655f49..32a806154e21 100644 --- a/servers/extensions/physics_server_2d_extension.cpp +++ b/servers/extensions/physics_server_2d_extension.cpp @@ -340,6 +340,7 @@ void PhysicsServer2DExtension::_bind_methods() { GDVIRTUAL_BIND(_end_sync); GDVIRTUAL_BIND(_finish); + GDVIRTUAL_BIND(_is_active); GDVIRTUAL_BIND(_is_flushing_queries); GDVIRTUAL_BIND(_get_process_info, "process_info"); } diff --git a/servers/extensions/physics_server_2d_extension.h b/servers/extensions/physics_server_2d_extension.h index 6e0277a7c681..e34ed6bcf774 100644 --- a/servers/extensions/physics_server_2d_extension.h +++ b/servers/extensions/physics_server_2d_extension.h @@ -446,6 +446,7 @@ class PhysicsServer2DExtension : public PhysicsServer2D { EXBIND0(end_sync) EXBIND0(finish) + EXBIND0RC(bool, is_active) EXBIND0RC(bool, is_flushing_queries) EXBIND1R(int, get_process_info, ProcessInfo) diff --git a/servers/extensions/physics_server_3d_extension.cpp b/servers/extensions/physics_server_3d_extension.cpp index 0937021c641f..1886c79ac26f 100644 --- a/servers/extensions/physics_server_3d_extension.cpp +++ b/servers/extensions/physics_server_3d_extension.cpp @@ -420,6 +420,7 @@ void PhysicsServer3DExtension::_bind_methods() { GDVIRTUAL_BIND(_end_sync); GDVIRTUAL_BIND(_finish); + GDVIRTUAL_BIND(_is_active); GDVIRTUAL_BIND(_is_flushing_queries); GDVIRTUAL_BIND(_get_process_info, "process_info"); } diff --git a/servers/extensions/physics_server_3d_extension.h b/servers/extensions/physics_server_3d_extension.h index eb8b62724582..b1ab8ed4af88 100644 --- a/servers/extensions/physics_server_3d_extension.h +++ b/servers/extensions/physics_server_3d_extension.h @@ -534,6 +534,7 @@ class PhysicsServer3DExtension : public PhysicsServer3D { EXBIND0(end_sync) EXBIND0(finish) + EXBIND0RC(bool, is_active) EXBIND0RC(bool, is_flushing_queries) EXBIND1R(int, get_process_info, ProcessInfo) diff --git a/servers/physics_2d/godot_physics_server_2d.h b/servers/physics_2d/godot_physics_server_2d.h index 991cf67c951f..05658b24c2e9 100644 --- a/servers/physics_2d/godot_physics_server_2d.h +++ b/servers/physics_2d/godot_physics_server_2d.h @@ -296,6 +296,7 @@ class GodotPhysicsServer2D : public PhysicsServer2D { virtual void end_sync() override; virtual void finish() override; + virtual bool is_active() const override { return active; } virtual bool is_flushing_queries() const override { return flushing_queries; } int get_process_info(ProcessInfo p_info) override; diff --git a/servers/physics_3d/godot_physics_server_3d.h b/servers/physics_3d/godot_physics_server_3d.h index 040e673dcd82..f017c7151b91 100644 --- a/servers/physics_3d/godot_physics_server_3d.h +++ b/servers/physics_3d/godot_physics_server_3d.h @@ -374,6 +374,7 @@ class GodotPhysicsServer3D : public PhysicsServer3D { virtual void end_sync() override; virtual void finish() override; + virtual bool is_active() const override { return active; } virtual bool is_flushing_queries() const override { return flushing_queries; } int get_process_info(ProcessInfo p_info) override; diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp index aea0c52a630f..f7a9e2894dc0 100644 --- a/servers/physics_server_2d.cpp +++ b/servers/physics_server_2d.cpp @@ -790,9 +790,12 @@ void PhysicsServer2D::_bind_methods() { ClassDB::bind_method(D_METHOD("free_rid", "rid"), &PhysicsServer2D::free); ClassDB::bind_method(D_METHOD("set_active", "active"), &PhysicsServer2D::set_active); + ClassDB::bind_method(D_METHOD("is_active"), &PhysicsServer2D::is_active); ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer2D::get_process_info); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "is_active"); + BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_RECYCLE_RADIUS); BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_MAX_SEPARATION); BIND_ENUM_CONSTANT(SPACE_PARAM_CONTACT_MAX_ALLOWED_PENETRATION); diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h index 67fc0ed899d5..c336fcf5ddf6 100644 --- a/servers/physics_server_2d.h +++ b/servers/physics_server_2d.h @@ -599,6 +599,7 @@ class PhysicsServer2D : public Object { virtual void end_sync() = 0; virtual void finish() = 0; + virtual bool is_active() const = 0; virtual bool is_flushing_queries() const = 0; enum ProcessInfo { diff --git a/servers/physics_server_2d_wrap_mt.h b/servers/physics_server_2d_wrap_mt.h index 5e2b3b408669..fa40e0456854 100644 --- a/servers/physics_server_2d_wrap_mt.h +++ b/servers/physics_server_2d_wrap_mt.h @@ -314,6 +314,10 @@ class PhysicsServer2DWrapMT : public PhysicsServer2D { virtual void flush_queries() override; virtual void finish() override; + virtual bool is_active() const override { + return physics_server_2d->is_active(); + } + virtual bool is_flushing_queries() const override { return physics_server_2d->is_flushing_queries(); } diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index f56ef11c14f4..c783d8636141 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -1029,9 +1029,12 @@ void PhysicsServer3D::_bind_methods() { ClassDB::bind_method(D_METHOD("free_rid", "rid"), &PhysicsServer3D::free); ClassDB::bind_method(D_METHOD("set_active", "active"), &PhysicsServer3D::set_active); + ClassDB::bind_method(D_METHOD("is_active"), &PhysicsServer3D::is_active); ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer3D::get_process_info); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "is_active"); + BIND_ENUM_CONSTANT(SHAPE_WORLD_BOUNDARY); BIND_ENUM_CONSTANT(SHAPE_SEPARATION_RAY); BIND_ENUM_CONSTANT(SHAPE_SPHERE); diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h index ea785fa03f1d..b07aaed8b559 100644 --- a/servers/physics_server_3d.h +++ b/servers/physics_server_3d.h @@ -802,6 +802,7 @@ class PhysicsServer3D : public Object { virtual void end_sync() = 0; virtual void finish() = 0; + virtual bool is_active() const = 0; virtual bool is_flushing_queries() const = 0; enum ProcessInfo { diff --git a/servers/physics_server_3d_wrap_mt.h b/servers/physics_server_3d_wrap_mt.h index 22f3ee0e4555..94a0a97f454b 100644 --- a/servers/physics_server_3d_wrap_mt.h +++ b/servers/physics_server_3d_wrap_mt.h @@ -387,6 +387,10 @@ class PhysicsServer3DWrapMT : public PhysicsServer3D { virtual void flush_queries() override; virtual void finish() override; + virtual bool is_active() const override { + return physics_server_3d->is_active(); + } + virtual bool is_flushing_queries() const override { return physics_server_3d->is_flushing_queries(); }