fix: align interaction anchors with collision areas

This commit is contained in:
ANG-Server
2026-07-21 23:47:24 +08:00
parent 74a0fb8309
commit aa19f157f2
2 changed files with 5 additions and 13 deletions

View File

@@ -85,7 +85,7 @@ func _resolve_anchor() -> Node2D:
return explicit_anchor
return _host
func _first_enabled_collision_shape(anchor: Node2D) -> CollisionShape2D:
func _first_enabled_collision_shape(anchor: Node) -> CollisionShape2D:
var direct_shape: CollisionShape2D = anchor as CollisionShape2D
if direct_shape != null and not direct_shape.disabled and direct_shape.shape != null:
return direct_shape
@@ -93,4 +93,8 @@ func _first_enabled_collision_shape(anchor: Node2D) -> CollisionShape2D:
var collision_shape: CollisionShape2D = child as CollisionShape2D
if collision_shape != null and not collision_shape.disabled and collision_shape.shape != null:
return collision_shape
for child: Node in anchor.get_children():
var nested_shape: CollisionShape2D = _first_enabled_collision_shape(child)
if nested_shape != null:
return nested_shape
return null

View File

@@ -117,9 +117,6 @@ size = Vector2(180, 160)
[sub_resource type="RectangleShape2D" id="Shape_NoticeBoard"]
size = Vector2(123, 88)
[sub_resource type="RectangleShape2D" id="Shape_WelcomeBoard"]
size = Vector2(97.5, 95)
[node name="Square" type="Node2D" unique_id=1071968945]
script = ExtResource("43_square")
@@ -1237,15 +1234,6 @@ script = ExtResource("28_notice")
position = Vector2(-59.5, 19)
shape = SubResource("Shape_NoticeBoard")
[node name="WelcomeBoardArea" type="Area2D" parent="InteractionAreas" unique_id=1460340742]
position = Vector2(707.5, 575)
collision_layer = 0
collision_mask = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionAreas/WelcomeBoardArea" unique_id=123982451]
position = Vector2(-159.25, -10.5)
shape = SubResource("Shape_WelcomeBoard")
[node name="BlockoutDebug" type="Node2D" parent="." unique_id=932099081]
visible = false