diff --git a/Characters/player.gd b/Characters/player.gd index f23e09f..70dfa46 100755 --- a/Characters/player.gd +++ b/Characters/player.gd @@ -383,7 +383,11 @@ func _find_edge_corner(normal: Vector2, dir: Vector2, reach: float) -> Variant: var line: Vector2 = surfaceHit.position - normal * 2 + dir * (pos - surfaceHit.position).dot(dir) var faceHit := _cast_ray(line + dir * reach, line - dir * radius) if not faceHit or faceHit.normal.dot(dir) < 0.5: return null - return faceHit.position + normal * 2 + var corner: Vector2 = faceHit.position + normal * 2 + # A real edge has empty space just past it, behind the surface. Seams + # between tiles (and the foot of a wall) have solid there, so they're not edges. + if not _is_point_free(corner + dir * 2 - normal * 2): return null + return corner # If this frame's movement along the surface would take us past its edge, stop # at the edge instead, until we've held towards it for MAX_SECS_TO_UNSTICK.