---
title: "hasAnyAncestor"
description: "Verifies whether any ancestor in the path to the 3D semantics root satisfies the given matcher."
type: "function"
lastmod: "2026-06-18T10:32:52.439333Z"
---
## API Reference

### hasAnyAncestor

> Source set: Android

```kotlin
public fun hasAnyAncestor(matcher: SubspaceSemanticsMatcher): SubspaceSemanticsMatcher
```

Verifies whether any ancestor in the path to the 3D semantics root satisfies the given matcher.

 For the following spatial semantic tree:
```
|-X
|-A |-B   |-C1   |-C2
```

In case of C1, we would check the matcher against A and B.

#### Parameters

| | |
| --- | --- |
| matcher | The semantic criteria to evaluate against all ancestors up to the root. |

#### Returns

| | |
| --- | --- |
|  | a matcher validating the presence of the specified ancestor. |
