forked from xiangwang25/whale-town-front-v2
fix: align interaction anchors with collision areas
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user