Merge pull request #40935 from hoontee/master-3

Transform CSGShape collision when necessary
This commit is contained in:
Rémi Verschelde 2020-08-11 11:58:36 +02:00 committed by GitHub
commit 3044b8f15a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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