fix: restrict 0.08 tile elevation exclusively to Stop n Go and Freemode
This commit is contained in:
+8
-10
@@ -192,18 +192,16 @@ func _hide_ground_tiles():
|
||||
func _setup_effect_elevation():
|
||||
var em = get_node_or_null("EnhancedGridMap")
|
||||
if em and em.mesh_library:
|
||||
# The arena is shifted down by -0.22, putting the physical 3D floor around Y=0.06.
|
||||
# To prevent gridmap tiles from clipping or being buried under the terrain,
|
||||
# we apply a universal Y-lift to all items in the mesh library so they render slightly above the grass.
|
||||
var ml = em.mesh_library.duplicate()
|
||||
var lift_transform = Transform3D().translated(Vector3(0, 0.08, 0))
|
||||
|
||||
for id in ml.get_item_list():
|
||||
# Skip non-walkable blocks since we hide them anyway
|
||||
if id == 4: continue
|
||||
var current_transform = ml.get_item_mesh_transform(id)
|
||||
ml.set_item_mesh_transform(id, lift_transform * current_transform)
|
||||
|
||||
# Only lift tiles for modes that use the shifted Terrainv2.gltf (-0.22 offset)
|
||||
if LobbyManager.game_mode in ["Stop n Go", "Freemode"]:
|
||||
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 current_transform = ml.get_item_mesh_transform(id)
|
||||
ml.set_item_mesh_transform(id, lift_transform * current_transform)
|
||||
|
||||
em.mesh_library = ml
|
||||
|
||||
# Force gridmap cell size to match player logic (1, 0.05, 1) - >0.001 to avoid errors
|
||||
|
||||
Reference in New Issue
Block a user