diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-31 18:56:35 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-31 18:56:35 +0100 |
commit | 935a6ef46b7c6af4239b6adce41b8198f051b57a (patch) | |
tree | 2d9832d705ef109a6aa47e2b0774a2ee43ff94b4 /servers/physics_server_2d.cpp | |
parent | ea3566f2ed375143d5ee036e841540739c62ae40 (diff) | |
parent | 026549db2eee3e5b356304e910e15e416f330c5e (diff) |
Merge pull request #72425 from smix8/default_physics_space_on_demand_only_4.x
Create default World physics spaces on demand only
Diffstat (limited to 'servers/physics_server_2d.cpp')
-rw-r--r-- | servers/physics_server_2d.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp index 15c2749484..f9a8d5f156 100644 --- a/servers/physics_server_2d.cpp +++ b/servers/physics_server_2d.cpp @@ -879,6 +879,23 @@ void PhysicsServer2D::_bind_methods() { PhysicsServer2D::PhysicsServer2D() { singleton = this; + + // World2D physics space + GLOBAL_DEF_BASIC("physics/2d/default_gravity", 980.0); + GLOBAL_DEF_BASIC("physics/2d/default_gravity_vector", Vector2(0, 1)); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/default_linear_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"), 0.1); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"), 1.0); + + // PhysicsServer2D + GLOBAL_DEF("physics/2d/sleep_threshold_linear", 2.0); + GLOBAL_DEF("physics/2d/sleep_threshold_angular", Math::deg_to_rad(8.0)); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/time_before_sleep", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5); + GLOBAL_DEF(PropertyInfo(Variant::INT, "physics/2d/solver/solver_iterations", PROPERTY_HINT_RANGE, "1,32,1,or_greater"), 16); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/solver/contact_recycle_radius", PROPERTY_HINT_RANGE, "0,10,0.01,or_greater"), 1.0); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/solver/contact_max_separation", PROPERTY_HINT_RANGE, "0,10,0.01,or_greater"), 1.5); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/solver/contact_max_allowed_penetration", PROPERTY_HINT_RANGE, "0,10,0.01,or_greater"), 0.3); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/solver/default_contact_bias", PROPERTY_HINT_RANGE, "0,1,0.01"), 0.8); + GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "physics/2d/solver/default_constraint_bias", PROPERTY_HINT_RANGE, "0,1,0.01"), 0.2); } PhysicsServer2D::~PhysicsServer2D() { |