Browse Source

Transform CSGShape collision when necessary

(cherry picked from commit fc8574fbac1073f4d68197dc8a2b3504bfc8970d)
hoontee 5 years ago
parent
commit
aa0221f0fb
1 changed files with 6 additions and 0 deletions
  1. 6 0
      modules/csg/csg_shape.cpp

+ 6 - 0
modules/csg/csg_shape.cpp

@@ -517,6 +517,12 @@ void CSGShape::_notification(int p_what) {
 		_make_dirty();
 	}
 
+	if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
+		if (use_collision && is_root_shape() && root_collision_instance.is_valid()) {
+			PhysicsServer::get_singleton()->body_set_state(root_collision_instance, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
+		}
+	}
+
 	if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
 
 		if (parent) {