Explorar el Código

Fix: Mass not set properly for RigidBody

Removed erroneous check, which caused _inv_mass not to be calculated when RigidBody2D or RigidBody3D used both custom center of mass and custom inertia.
Crimzoth hace 2 años
padre
commit
3bab21fdd7
Se han modificado 2 ficheros con 2 adiciones y 2 borrados
  1. 1 1
      servers/physics_2d/godot_body_2d.cpp
  2. 1 1
      servers/physics_3d/godot_body_3d.cpp

+ 1 - 1
servers/physics_2d/godot_body_2d.cpp

@@ -35,7 +35,7 @@
 #include "godot_space_2d.h"
 #include "godot_space_2d.h"
 
 
 void GodotBody2D::_mass_properties_changed() {
 void GodotBody2D::_mass_properties_changed() {
-	if (get_space() && !mass_properties_update_list.in_list() && (calculate_inertia || calculate_center_of_mass)) {
+	if (get_space() && !mass_properties_update_list.in_list()) {
 		get_space()->body_add_to_mass_properties_update_list(&mass_properties_update_list);
 		get_space()->body_add_to_mass_properties_update_list(&mass_properties_update_list);
 	}
 	}
 }
 }

+ 1 - 1
servers/physics_3d/godot_body_3d.cpp

@@ -35,7 +35,7 @@
 #include "godot_space_3d.h"
 #include "godot_space_3d.h"
 
 
 void GodotBody3D::_mass_properties_changed() {
 void GodotBody3D::_mass_properties_changed() {
-	if (get_space() && !mass_properties_update_list.in_list() && (calculate_inertia || calculate_center_of_mass)) {
+	if (get_space() && !mass_properties_update_list.in_list()) {
 		get_space()->body_add_to_mass_properties_update_list(&mass_properties_update_list);
 		get_space()->body_add_to_mass_properties_update_list(&mass_properties_update_list);
 	}
 	}
 }
 }