summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-10-09 14:08:50 +0200
committerGitHub <noreply@github.com>2016-10-09 14:08:50 +0200
commit1c6058a5bc3db61aa12c3fae11b216828e2bc5a5 (patch)
treec38c4e011451c19f37bd11b59d8925edd59df2b9 /scene
parentfb856e532e4c7a4fb7a61c1e9431bc664a77dbfc (diff)
parent1d09c27ba4b94e677b66d8d2c2b9e38f7829ad38 (diff)
Merge pull request #6691 from Faless/expose_more_physics
Expose more 2D/3D physics options in project settings (#5029)
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/world.cpp4
-rw-r--r--scene/resources/world_2d.cpp6
-rw-r--r--scene/resources/world_2d.h1
3 files changed, 5 insertions, 6 deletions
diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp
index 0a88abf252..1aeea5fa43 100644
--- a/scene/resources/world.cpp
+++ b/scene/resources/world.cpp
@@ -332,6 +332,10 @@ World::World() {
sound_space = SpatialSoundServer::get_singleton()->space_create();
PhysicsServer::get_singleton()->space_set_active(space,true);
+ PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics/default_gravity",9.8));
+ PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics/default_gravity_vector",Vector3(0,-1,0)));
+ PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics/default_linear_damp",0.1));
+ PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics/default_angular_damp",0.1));
#ifdef _3D_DISABLED
indexer = NULL;
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index 4c963da5b4..df3a374fc9 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -416,12 +416,6 @@ World2D::World2D() {
}
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);
- Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION,0.3);
- Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD,2);
- Physics2DServer::get_singleton()->space_set_param(space,Physics2DServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS,0.2);
-
indexer = memnew( SpatialIndexer2D );
}
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index a939d935c4..d52189bcd4 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -31,6 +31,7 @@
#include "resource.h"
#include "servers/physics_2d_server.h"
+#include "globals.h"
class SpatialIndexer2D;
class VisibilityNotifier2D;