summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-06-04 16:08:37 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-06-04 16:08:37 +0200
commit280e3611b90c40fc26c7b7295430703f70f50f03 (patch)
treeb50ea3c454f02c15daba0b292cc85028dfef1494
parentf1cd33b53916f47ee4b60440f5b37dd08bec0c9e (diff)
parenta068152ba08cde6933db6862b9b440d3b5cc00a5 (diff)
Merge pull request #5032 from akien-mga/pr-defaut-linear-damp
Physics2D: Rename default_density to default_linear_damp
-rw-r--r--scene/resources/world_2d.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index 8cacc0fce7..e96cac170b 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -373,7 +373,15 @@ World2D::World2D() {
Physics2DServer::get_singleton()->space_set_active(space,true);
Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics_2d/default_gravity",98));
Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics_2d/default_gravity_vector",Vector2(0,1)));
- Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics_2d/default_density",0.1));
+ // TODO: Remove this deprecation warning and compatibility code for 2.2 or 3.0
+ if (Globals::get_singleton()->get("physics_2d/default_density") && !Globals::get_singleton()->get("physics_2d/default_linear_damp)")) {
+ WARN_PRINT("Deprecated parameter 'physics_2d/default_density'. It was renamed to 'physics_2d/default_linear_damp', adjusting your project settings accordingly (make sure to adjust scripts that potentially rely on 'physics_2d/default_density'.");
+ Globals::get_singleton()->set("physics_2d/default_linear_damp", Globals::get_singleton()->get("physics_2d/default_density"));
+ Globals::get_singleton()->set_persisting("physics_2d/default_linear_damp", true);
+ Globals::get_singleton()->set_persisting("physics_2d/default_density", false);
+ Globals::get_singleton()->save();
+ }
+ Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics_2d/default_linear_damp",0.1));
Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics_2d/default_angular_damp",1));
Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS,1.0);
Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONTACT_MAX_SEPARATION,1.5);