Skip to content

Commit

Permalink
sleeping property now should work properly, fixes godotengine#1892
Browse files Browse the repository at this point in the history
  • Loading branch information
reduz committed May 16, 2015
1 parent 8482611 commit bbe9a37
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions servers/physics/body_sw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant& p_varian
Transform t = p_variant;
t.orthonormalize();
new_transform=get_transform(); //used as old to compute motion
if (new_transform==t)
break;
_set_transform(t);
_set_inv_transform(get_transform().inverse());

Expand Down
2 changes: 1 addition & 1 deletion servers/physics/body_sw.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ friend class PhysicsDirectBodyStateSW; // i give up, too many functions to expos
_FORCE_INLINE_ bool is_active() const { return active; }

_FORCE_INLINE_ void wakeup() {
if ((get_space() && active) || mode==PhysicsServer::BODY_MODE_STATIC || mode==PhysicsServer::BODY_MODE_KINEMATIC)
if ((!get_space()) || mode==PhysicsServer::BODY_MODE_STATIC || mode==PhysicsServer::BODY_MODE_KINEMATIC)
return;
set_active(true);
}
Expand Down
2 changes: 2 additions & 0 deletions servers/physics_2d/body_2d_sw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant& p_va
Matrix32 t = p_variant;
t.orthonormalize();
new_transform=get_transform(); //used as old to compute motion
if (t==new_transform)
break;
_set_transform(t);
_set_inv_transform(get_transform().inverse());

Expand Down
2 changes: 1 addition & 1 deletion servers/physics_2d/body_2d_sw.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ friend class Physics2DDirectBodyStateSW; // i give up, too many functions to exp
_FORCE_INLINE_ bool is_active() const { return active; }

_FORCE_INLINE_ void wakeup() {
if ((get_space() && active) || mode==Physics2DServer::BODY_MODE_STATIC || mode==Physics2DServer::BODY_MODE_KINEMATIC)
if ((!get_space()) || mode==Physics2DServer::BODY_MODE_STATIC || mode==Physics2DServer::BODY_MODE_KINEMATIC)
return;
set_active(true);
}
Expand Down

0 comments on commit bbe9a37

Please sign in to comment.