fix: adjust safe zone elevation and transparency sorting priority to prevent it covering tiles or clipping with terrain

This commit is contained in:
2026-07-06 17:42:26 +08:00
parent b879c7b684
commit f1ef43cb38
2 changed files with 11 additions and 1 deletions
+9 -1
View File
@@ -199,8 +199,16 @@ func _setup_effect_elevation():
var lift_transform = Transform3D().translated(Vector3(0, 0.08, 0))
for id in ml.get_item_list():
if id == 4: continue # Skip hidden non-walkable blocks
var apply_transform = lift_transform
# TILE_SAFE (2) is painted on Layer 2 (Y=0.10).
# We want it below all grid tiles (Layer 0 is at 0.08) but above the terrain (0.06).
# We set it to 0.07 by applying a -0.03 offset (0.10 - 0.03 = 0.07).
if id == 2:
apply_transform = Transform3D().translated(Vector3(0, -0.03, 0))
var current_transform = ml.get_item_mesh_transform(id)
ml.set_item_mesh_transform(id, lift_transform * current_transform)
ml.set_item_mesh_transform(id, apply_transform * current_transform)
em.mesh_library = ml
+2
View File
@@ -674,6 +674,8 @@ func _animate_safe_zone_appear():
# Duplicate mesh+material so we animate without touching the shared .tres on disk.
var anim_mat: StandardMaterial3D = mat.duplicate()
anim_mat.albedo_color = Color(mat.albedo_color.r, mat.albedo_color.g, mat.albedo_color.b, 0.0)
# Force render priority so the transparent decal correctly sorts over the terrain
anim_mat.render_priority = 1
var anim_mesh = original_mesh.duplicate()
anim_mesh.material = anim_mat