mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
fix rare physics crash
This commit is contained in:
parent
8c70c18132
commit
ef9b82a076
@ -616,6 +616,8 @@ void GodotBody2D::integrate_velocities(real_t p_step) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ERR_FAIL_NULL(get_space());
|
||||||
|
|
||||||
if (fi_callback_data || body_state_callback.is_valid()) {
|
if (fi_callback_data || body_state_callback.is_valid()) {
|
||||||
get_space()->body_add_to_state_query_list(&direct_state_query_list);
|
get_space()->body_add_to_state_query_list(&direct_state_query_list);
|
||||||
}
|
}
|
||||||
@ -705,6 +707,8 @@ bool GodotBody2D::sleep_test(real_t p_step) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ERR_FAIL_NULL_V(get_space(), true);
|
||||||
|
|
||||||
if (Math::abs(angular_velocity) < get_space()->get_body_angular_velocity_sleep_threshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_threshold() * get_space()->get_body_linear_velocity_sleep_threshold()) {
|
if (Math::abs(angular_velocity) < get_space()->get_body_angular_velocity_sleep_threshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_threshold() * get_space()->get_body_linear_velocity_sleep_threshold()) {
|
||||||
still_time += p_step;
|
still_time += p_step;
|
||||||
|
|
||||||
|
@ -675,6 +675,8 @@ void GodotBody3D::integrate_velocities(real_t p_step) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ERR_FAIL_NULL(get_space());
|
||||||
|
|
||||||
if (fi_callback_data || body_state_callback.is_valid()) {
|
if (fi_callback_data || body_state_callback.is_valid()) {
|
||||||
get_space()->body_add_to_state_query_list(&direct_state_query_list);
|
get_space()->body_add_to_state_query_list(&direct_state_query_list);
|
||||||
}
|
}
|
||||||
@ -784,6 +786,8 @@ bool GodotBody3D::sleep_test(real_t p_step) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ERR_FAIL_NULL_V(get_space(), true);
|
||||||
|
|
||||||
if (Math::abs(angular_velocity.length()) < get_space()->get_body_angular_velocity_sleep_threshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_threshold() * get_space()->get_body_linear_velocity_sleep_threshold()) {
|
if (Math::abs(angular_velocity.length()) < get_space()->get_body_angular_velocity_sleep_threshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_threshold() * get_space()->get_body_linear_velocity_sleep_threshold()) {
|
||||||
still_time += p_step;
|
still_time += p_step;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user