diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index c0ed3a9..d68de63 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -831,19 +831,16 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false) # Apply multiplicative tint to all StandardMaterial3D surfaces. _apply_model_tint(model_node, model_tint) - # Restore the body to its correct world height (uses y_offset captured - # from the outer scope, which accounts for tile_h and the unit's - # half-height). Skip if a move tween is currently driving the body. + # Restore the body to its correct world height. Skip if a move tween + # is currently driving the body. if not _move_anims.has(iid): - b.position = wp + Vector3(0, y_offset, 0) + b.position = wp + Vector3(0, tile_base + tile_h + above_tile, 0) b.add_child(model_node) - # Seat the model's AABB bottom (feet) on the tile surface (world Y = tile_h). - # Using the AABB makes this work regardless of where the model's local origin - # is — at the feet, at the geometric centre, or anywhere else. - # body-local feet = (tile_h - y_offset) - scale.y * aabb.position.y + # Seat the model's AABB bottom (feet) on the tile surface. + # body-local Y=0 is the tile top; feet target = -above_tile. var m_aabb := _model_local_aabb(model_node) if m_aabb.size != Vector3.ZERO: - model_node.position.y = (tile_h - y_offset) - model_node.scale.y * m_aabb.position.y + model_node.position.y = -above_tile - model_node.scale.y * m_aabb.position.y _unit_meshes[iid] = model_node # Find and store the AnimationPlayer, then start the Idle loop.