Fix: update GLB-load closure to use above_tile instead of y_offset
y_offset was renamed to above_tile in the previous commit but the ModelCache callback closure still referenced the old name, causing GDScript parse errors on lines 838 and 846. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user