From 14d46b8823afe6603feaaaf76091bbf127b7e03f Mon Sep 17 00:00:00 2001 From: adtpdn Date: Mon, 6 Jul 2026 16:01:58 +0800 Subject: [PATCH] fix: shift Freemode 3D arena down to Y=0 to prevent buried tiles, remove deprecated mesh elevation hacks --- scenes/main.gd | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/scenes/main.gd b/scenes/main.gd index e4b1c24..365ea07 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -165,6 +165,12 @@ func _instantiate_3d_arena(scene_path: String): if arena_scene: var arena_instance = arena_scene.instantiate() arena_instance.name = "ArenaEnvironment3D" + + if "freemode" in scene_path: + # The Freemode Terrainv2.gltf has its floor physically modeled at Y=0.28. + # Shift it down so the visual floor aligns with Y=0.0 where players and gridmap items live. + arena_instance.position.y = -0.28 + add_child(arena_instance) move_child(arena_instance, 0) print("Instantiated 3D Arena: ", scene_path) @@ -186,22 +192,9 @@ func _hide_ground_tiles(): func _setup_effect_elevation(): var em = get_node_or_null("EnhancedGridMap") if em and em.mesh_library: - # USER REQUEST: Do not apply visual Y-elevation for walls in Stop n Go mode - if LobbyManager.game_mode == "Stop n Go": - print("[Main] Stop n Go mode detected: Skipping effect elevation for walls.") - return - - var ml = em.mesh_library.duplicate() - - # Height 0.8: Above 3D arena, but below pickups (Y=1.0) - var lift_transform = Transform3D().translated(Vector3(0, 0.28, 0)) - - # Lift Wall (4) and Freeze (5) - ml.set_item_mesh_transform(4, lift_transform) - ml.set_item_mesh_transform(5, lift_transform) - - em.mesh_library = ml - print("[Main] MeshLibrary elevation applied: Wall(4) and Freeze(5) at Y=0.8") + # Since the Freemode arena is now shifted to Y=0.0, we no longer need to lift + # Wall(4) and Freeze(5) meshes by 0.28 to match the old floor height! + pass # Force gridmap cell size to match player logic (1, 0.05, 1) - >0.001 to avoid errors if not em: @@ -1276,7 +1269,7 @@ func _create_static_setup(pos: Vector2i, tekton_id: int, shape_idx: int): if "cell_size" in enhanced_gridmap: world_pos = Vector3( pos.x * enhanced_gridmap.cell_size.x + enhanced_gridmap.cell_size.x / 2, - 0.28, # Match the 0.28 elevation of the arena floor + 0.0, # Floor is now at 0.0 after arena shift pos.y * enhanced_gridmap.cell_size.z + enhanced_gridmap.cell_size.z / 2 ) stand.global_position = world_pos