@ -45,6 +45,15 @@ void CollisionShape2D::_shape_changed() {
update ( ) ;
}
void CollisionShape2D : : _update_in_shape_owner ( bool p_xform_only ) {
parent - > shape_owner_set_transform ( owner_id , get_transform ( ) ) ;
if ( p_xform_only )
return ;
parent - > shape_owner_set_disabled ( owner_id , disabled ) ;
parent - > shape_owner_set_one_way_collision ( owner_id , one_way_collision ) ;
}
void CollisionShape2D : : _notification ( int p_what ) {
switch ( p_what ) {
@ -57,9 +66,7 @@ void CollisionShape2D::_notification(int p_what) {
if ( shape . is_valid ( ) ) {
parent - > shape_owner_add_shape ( owner_id , shape ) ;
}
parent - > shape_owner_set_transform ( owner_id , get_transform ( ) ) ;
parent - > shape_owner_set_disabled ( owner_id , disabled ) ;
parent - > shape_owner_set_one_way_collision ( owner_id , one_way_collision ) ;
_update_in_shape_owner ( ) ;
}
/*if (Engine::get_singleton()->is_editor_hint()) {
@ -68,11 +75,18 @@ void CollisionShape2D::_notification(int p_what) {
set_z_index ( VS : : CANVAS_ITEM_Z_MAX - 1 ) ;
} */
} break ;
case NOTIFICATION_ENTER_TREE : {
if ( parent ) {
_update_in_shape_owner ( ) ;
}
} break ;
case NOTIFICATION_LOCAL_TRANSFORM_CHANGED : {
if ( parent ) {
parent - > shape_owner_set_transform ( owner_id , get_transform ( ) ) ;
_update_in_shape_owner( true ) ;
}
} break ;