diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-17 16:45:10 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-17 16:45:10 -0300 |
commit | 95dc15b75096b7f4017b16ddae9066ee2deb3934 (patch) | |
tree | 82224818e129a988ce2a49902b3a1e82d7c75e8c /scene/3d/physics_body.cpp | |
parent | 6a68ce9c93fb47d69718cf41c97074138b81c620 (diff) | |
download | redot-engine-95dc15b75096b7f4017b16ddae9066ee2deb3934.tar.gz |
Send body inout notifications after state is applied, fixes #4683
Diffstat (limited to 'scene/3d/physics_body.cpp')
-rw-r--r-- | scene/3d/physics_body.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 243cb31aca..116f967bd2 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -397,6 +397,18 @@ void RigidBody::_direct_state_changed(Object *p_state) { state=(PhysicsDirectBodyState*)p_state; //trust it #endif + set_ignore_transform_notification(true); + set_global_transform(state->get_transform()); + linear_velocity=state->get_linear_velocity(); + angular_velocity=state->get_angular_velocity(); + if(sleeping!=state->is_sleeping()) { + sleeping=state->is_sleeping(); + emit_signal(SceneStringNames::get_singleton()->sleeping_state_changed); + } + if (get_script_instance()) + get_script_instance()->call("_integrate_forces",state); + set_ignore_transform_notification(false); + if (contact_monitor) { contact_monitor->locked=true; @@ -484,17 +496,7 @@ void RigidBody::_direct_state_changed(Object *p_state) { } - set_ignore_transform_notification(true); - set_global_transform(state->get_transform()); - linear_velocity=state->get_linear_velocity(); - angular_velocity=state->get_angular_velocity(); - if(sleeping!=state->is_sleeping()) { - sleeping=state->is_sleeping(); - emit_signal(SceneStringNames::get_singleton()->sleeping_state_changed); - } - if (get_script_instance()) - get_script_instance()->call("_integrate_forces",state); - set_ignore_transform_notification(false); + state=NULL; } |