summaryrefslogtreecommitdiff
path: root/servers/physics
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-01-02 13:28:18 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-01-02 13:28:18 -0300
commit27c47e09a183359706ef2497da9278b46f9190b6 (patch)
tree65e4564f46f5763b3220bcfc027dc439fd581a7c /servers/physics
parent757b8c4206a9853313ea46f738d1bfad501a6821 (diff)
skip the first integration in physics bodies, fixes #2213
Diffstat (limited to 'servers/physics')
-rw-r--r--servers/physics/body_sw.cpp6
-rw-r--r--servers/physics/body_sw.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp
index bfac852481..b0ed99cb48 100644
--- a/servers/physics/body_sw.cpp
+++ b/servers/physics/body_sw.cpp
@@ -380,6 +380,8 @@ void BodySW::set_space(SpaceSW *p_space){
}
+ first_integration=true;
+
}
void BodySW::_compute_area_gravity_and_dampenings(const AreaSW *p_area) {
@@ -479,7 +481,7 @@ void BodySW::integrate_forces(real_t p_step) {
do_motion=true;
} else {
- if (!omit_force_integration) {
+ if (!omit_force_integration && !first_integration) {
//overriden by direct state query
Vector3 force=gravity*mass;
@@ -512,6 +514,7 @@ void BodySW::integrate_forces(real_t p_step) {
applied_force=Vector3();
applied_torque=Vector3();
+ first_integration=false;
//motion=linear_velocity*p_step;
@@ -749,6 +752,7 @@ BodySW::BodySW() : CollisionObjectSW(TYPE_BODY), active_list(this), inertia_upda
island_next=NULL;
island_list_next=NULL;
first_time_kinematic=false;
+ first_integration=false;
_set_static(false);
contact_count=0;
diff --git a/servers/physics/body_sw.h b/servers/physics/body_sw.h
index 7369b4cecf..c958177a19 100644
--- a/servers/physics/body_sw.h
+++ b/servers/physics/body_sw.h
@@ -79,6 +79,8 @@ class BodySW : public CollisionObjectSW {
bool omit_force_integration;
bool active;
+ bool first_integration;
+
bool continuous_cd;
bool can_sleep;
bool first_time_kinematic;