diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-02 13:28:18 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-02 13:28:18 -0300 |
commit | 27c47e09a183359706ef2497da9278b46f9190b6 (patch) | |
tree | 65e4564f46f5763b3220bcfc027dc439fd581a7c /servers/physics_2d/body_2d_sw.cpp | |
parent | 757b8c4206a9853313ea46f738d1bfad501a6821 (diff) |
skip the first integration in physics bodies, fixes #2213
Diffstat (limited to 'servers/physics_2d/body_2d_sw.cpp')
-rw-r--r-- | servers/physics_2d/body_2d_sw.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index 129ce708d7..6721e188d2 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -378,6 +378,7 @@ void Body2DSW::set_space(Space2DSW *p_space){ } + first_integration=false; } void Body2DSW::_compute_area_gravity_and_dampenings(const Area2DSW *p_area) { @@ -471,7 +472,7 @@ void Body2DSW::integrate_forces(real_t p_step) { //} } else { - if (!omit_force_integration) { + if (!omit_force_integration && !first_integration) { //overriden by direct state query Vector2 force=gravity*mass; @@ -506,6 +507,7 @@ void Body2DSW::integrate_forces(real_t p_step) { //motion=linear_velocity*p_step; + first_integration=false; biased_angular_velocity=0; biased_linear_velocity=Vector2(); @@ -681,6 +683,7 @@ Body2DSW::Body2DSW() : CollisionObject2DSW(TYPE_BODY), active_list(this), inerti gravity_scale=1.0; using_one_way_cache=false; one_way_collision_max_depth=0.1; + first_integration=false; still_time=0; continuous_cd_mode=Physics2DServer::CCD_MODE_DISABLED; |