Send body inout notifications after state is applied, fixes #4683
This commit is contained in:
parent
6a68ce9c93
commit
95dc15b750
|
@ -450,6 +450,19 @@ void RigidBody2D::_direct_state_changed(Object *p_state) {
|
||||||
state=(Physics2DDirectBodyState*)p_state; //trust it
|
state=(Physics2DDirectBodyState*)p_state; //trust it
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
set_block_transform_notify(true); // don't want notify (would feedback loop)
|
||||||
|
if (mode!=MODE_KINEMATIC)
|
||||||
|
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_block_transform_notify(false); // want it back
|
||||||
|
|
||||||
if (contact_monitor) {
|
if (contact_monitor) {
|
||||||
|
|
||||||
contact_monitor->locked=true;
|
contact_monitor->locked=true;
|
||||||
|
@ -539,18 +552,7 @@ void RigidBody2D::_direct_state_changed(Object *p_state) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_block_transform_notify(true); // don't want notify (would feedback loop)
|
|
||||||
if (mode!=MODE_KINEMATIC)
|
|
||||||
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_block_transform_notify(false); // want it back
|
|
||||||
|
|
||||||
state=NULL;
|
state=NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,6 +397,18 @@ void RigidBody::_direct_state_changed(Object *p_state) {
|
||||||
state=(PhysicsDirectBodyState*)p_state; //trust it
|
state=(PhysicsDirectBodyState*)p_state; //trust it
|
||||||
#endif
|
#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) {
|
if (contact_monitor) {
|
||||||
|
|
||||||
contact_monitor->locked=true;
|
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;
|
state=NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue