diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index d1edcd2496d..2af30c4e592 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -592,13 +592,15 @@ void Sprite3D::_draw() { copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4); copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 2 * 2); } - set_aabb(aabb); write_buffer.release(); RID mesh = get_mesh(); VS::get_singleton()->mesh_surface_update_region(mesh, 0, 0, mesh_buffer); + VS::get_singleton()->mesh_set_custom_aabb(mesh, aabb); + set_aabb(aabb); + set_base(mesh); RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == SpatialMaterial::BILLBOARD_ENABLED, get_billboard_mode() == SpatialMaterial::BILLBOARD_FIXED_Y); @@ -950,13 +952,15 @@ void AnimatedSprite3D::_draw() { copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_COLOR]], v_color, 4); copymem(&write_buffer[i * mesh_stride + mesh_surface_offsets[VS::ARRAY_TEX_UV]], v_uv, 2 * 2); } - set_aabb(aabb); write_buffer.release(); RID mesh = get_mesh(); VS::get_singleton()->mesh_surface_update_region(mesh, 0, 0, mesh_buffer); + VS::get_singleton()->mesh_set_custom_aabb(mesh, aabb); + set_aabb(aabb); + set_base(mesh); RID mat = SpatialMaterial::get_material_rid_for_2d(get_draw_flag(FLAG_SHADED), get_draw_flag(FLAG_TRANSPARENT), get_draw_flag(FLAG_DOUBLE_SIDED), get_alpha_cut_mode() == ALPHA_CUT_DISCARD, get_alpha_cut_mode() == ALPHA_CUT_OPAQUE_PREPASS, get_billboard_mode() == SpatialMaterial::BILLBOARD_ENABLED, get_billboard_mode() == SpatialMaterial::BILLBOARD_FIXED_Y);