> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor/ks.reactor.ksqueryhitresults-1.md).

# Struct ksQueryHitResults\<T>

Namespace: [KS.Reactor](/reactor/api-reference/ks.reactor.md)\
Assembly: KSCommon.dll

Struct containing touching hits and the blocking hit results from a raycast or sweep query.

```csharp
public struct ksQueryHitResults<T> : IEnumerable<T>, IEnumerable where T : ksIQueryHitResult
```

#### Type Parameters

`T`

Query result type

#### Implements

[IEnumerable\<T>](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Properties

### Block <a href="#ks_reactor_ksqueryhitresults_1_block" id="ks_reactor_ksqueryhitresults_1_block"></a>

The blocking hit. See [BLOCK](/reactor/api-reference/ks.reactor/ks.reactor.ksqueryhittypes.md#KS_Reactor_ksQueryHitTypes_BLOCK). [IsValid](/reactor/api-reference/ks.reactor/ks.reactor.ksiqueryhitresult.md#KS_Reactor_ksIQueryHitResult_IsValid) will be false if there was no blocking hit. The setter sets [HasBlock](/reactor/api-reference/ks.reactor.md#KS_Reactor_ksQueryHitResults_601_HasBlock) to [IsValid](/reactor/api-reference/ks.reactor/ks.reactor.ksiqueryhitresult.md#KS_Reactor_ksIQueryHitResult_IsValid).

```csharp
public T Block { get; set; }
```

#### Property Value

T

### Count <a href="#ks_reactor_ksqueryhitresults_1_count" id="ks_reactor_ksqueryhitresults_1_count"></a>

The total number of hits, including the blocking hit.

```csharp
public int Count { get; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### HasBlock <a href="#ks_reactor_ksqueryhitresults_1_hasblock" id="ks_reactor_ksqueryhitresults_1_hasblock"></a>

Is there a blocking hit? See [BLOCK](/reactor/api-reference/ks.reactor/ks.reactor.ksqueryhittypes.md#KS_Reactor_ksQueryHitTypes_BLOCK)

```csharp
public bool HasBlock { get; set; }
```

#### Property Value

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### Touches <a href="#ks_reactor_ksqueryhitresults_1_touches" id="ks_reactor_ksqueryhitresults_1_touches"></a>

The list of touching hits. See [TOUCH](/reactor/api-reference/ks.reactor/ks.reactor.ksqueryhittypes.md#KS_Reactor_ksQueryHitTypes_TOUCH).

```csharp
public List<T> Touches { get; }
```

#### Property Value

[List](https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)\<T>

## Methods

### GetEnumerator() <a href="#ks_reactor_ksqueryhitresults_1_getenumerator" id="ks_reactor_ksqueryhitresults_1_getenumerator"></a>

Iterates the touching hits, followed by the blocking hit.

```csharp
public IEnumerator<T> GetEnumerator()
```

#### Returns

[IEnumerator](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerator-1)\<T>

Enumerator

### SortByDistance() <a href="#ks_reactor_ksqueryhitresults_1_sortbydistance" id="ks_reactor_ksqueryhitresults_1_sortbydistance"></a>

Sorts [Touches](/reactor/api-reference/ks.reactor.md#KS_Reactor_ksQueryHitResults_601_Touches) by distance from nearest to farthest.

```csharp
public void SortByDistance()
```

### TryGetBlock(out T) <a href="#ks_reactor_ksqueryhitresults_1_trygetblock__0" id="ks_reactor_ksqueryhitresults_1_trygetblock__0"></a>

Gets the blocking hit if there is one.

```csharp
public bool TryGetBlock(out T block)
```

#### Parameters

`block` T

Set to the blocking hit.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if [HasBlock](/reactor/api-reference/ks.reactor.md#KS_Reactor_ksQueryHitResults_601_HasBlock) is true.
