> 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.client.unity/ks.reactor.client.unity.ksunitycollider.md).

# Class ksUnityCollider

Namespace: [KS.Reactor.Client.Unity](/reactor/api-reference/ks.reactor.client.unity.md)\
Assembly: KSUnity-Source.dll

Wraps a Unity collider for use with Reactor.

```csharp
public class ksUnityCollider : ksIUnityCollider, ksICollider
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ← [ksUnityCollider](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksunitycollider.md)

#### Implements

[ksIUnityCollider](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksiunitycollider.md), [ksICollider](/reactor/api-reference/ks.reactor/ks.reactor.ksicollider.md)

#### 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.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Constructors

### ksUnityCollider(Collider, ksColliderData) <a href="#ks_reactor_client_unity_ksunitycollider__ctor_unityengine_collider_ks_reactor_client_unity_kscollide" id="ks_reactor_client_unity_ksunitycollider__ctor_unityengine_collider_ks_reactor_client_unity_kscollide"></a>

Constructor

```csharp
public ksUnityCollider(Collider collider, ksColliderData data = null)
```

#### Parameters

`collider` Collider

Determines shape type base on the Unity collider type. Not all colliders are supported.

`data` [ksColliderData](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.kscolliderdata.md)

Collider data associated with the collider.

## Properties

### Bounds <a href="#ks_reactor_client_unity_ksunitycollider_bounds" id="ks_reactor_client_unity_ksunitycollider_bounds"></a>

Get the bounds of a collider at the position of its attached entity.

```csharp
public ksBounds Bounds { get; }
```

#### Property Value

[ksBounds](/reactor/api-reference/ks.reactor/ks.reactor.ksbounds.md)

### Center <a href="#ks_reactor_client_unity_ksunitycollider_center" id="ks_reactor_client_unity_ksunitycollider_center"></a>

Get the collider center.

```csharp
public Vector3 Center { get; }
```

#### Property Value

Vector3

### Collider <a href="#ks_reactor_client_unity_ksunitycollider_collider" id="ks_reactor_client_unity_ksunitycollider_collider"></a>

Unity collider.

```csharp
public Collider Collider { get; }
```

#### Property Value

Collider

### CollisionFilter <a href="#ks_reactor_client_unity_ksunitycollider_collisionfilter" id="ks_reactor_client_unity_ksunitycollider_collisionfilter"></a>

Get/Set the collision filter on the collider.

```csharp
public ksCollisionFilter CollisionFilter { get; set; }
```

#### Property Value

[ksCollisionFilter](/reactor/api-reference/ks.reactor/ks.reactor.kscollisionfilter.md)

### Component <a href="#ks_reactor_client_unity_ksunitycollider_component" id="ks_reactor_client_unity_ksunitycollider_component"></a>

Unity collider component.

```csharp
public Component Component { get; }
```

#### Property Value

Component

### ContactOffset <a href="#ks_reactor_client_unity_ksunitycollider_contactoffset" id="ks_reactor_client_unity_ksunitycollider_contactoffset"></a>

Get/Set contact offset on a collider

```csharp
public float ContactOffset { get; set; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

### Data <a href="#ks_reactor_client_unity_ksunitycollider_data" id="ks_reactor_client_unity_ksunitycollider_data"></a>

The collider data.

```csharp
public ksColliderData Data { get; }
```

#### Property Value

[ksColliderData](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.kscolliderdata.md)

### Entity <a href="#ks_reactor_client_unity_ksunitycollider_entity" id="ks_reactor_client_unity_ksunitycollider_entity"></a>

Get the entity this collider is attached to.

```csharp
public ksIEntity Entity { get; }
```

#### Property Value

[ksIEntity](/reactor/api-reference/ks.reactor/ks.reactor.ksientity.md)

### Existance <a href="#ks_reactor_client_unity_ksunitycollider_existance" id="ks_reactor_client_unity_ksunitycollider_existance"></a>

Does this collider exist on the client, server, or both? Note that this only affects whether or not the collider is written to server configs during publishing or whether the collider is deleted on the client when the entity is spawned and may not be indicative of the current existance of the collider on the server at runtime.

```csharp
public ksExistenceModes Existance { get; }
```

#### Property Value

[ksExistenceModes](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksexistencemodes.md)

### IsEnabled <a href="#ks_reactor_client_unity_ksunitycollider_isenabled" id="ks_reactor_client_unity_ksunitycollider_isenabled"></a>

Get/Set the enabled state of a collider

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

#### Property Value

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

### IsQueryCollider <a href="#ks_reactor_client_unity_ksunitycollider_isquerycollider" id="ks_reactor_client_unity_ksunitycollider_isquerycollider"></a>

Get/Set if this collider is used in scene queries.

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

#### Property Value

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

### IsSimulationCollider <a href="#ks_reactor_client_unity_ksunitycollider_issimulationcollider" id="ks_reactor_client_unity_ksunitycollider_issimulationcollider"></a>

Get/Set if this collider is used in physics simulations.

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

#### Property Value

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

### IsTrigger <a href="#ks_reactor_client_unity_ksunitycollider_istrigger" id="ks_reactor_client_unity_ksunitycollider_istrigger"></a>

Get/Set if this collider is a trigger.

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

#### Property Value

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

### Material <a href="#ks_reactor_client_unity_ksunitycollider_material" id="ks_reactor_client_unity_ksunitycollider_material"></a>

Physics material.

```csharp
public PhysicMaterial Material { get; }
```

#### Property Value

PhysicMaterial

### ShapeType <a href="#ks_reactor_client_unity_ksunitycollider_shapetype" id="ks_reactor_client_unity_ksunitycollider_shapetype"></a>

Get the collider shape type.

```csharp
public ksShape.ShapeTypes ShapeType { get; }
```

#### Property Value

[ksShape](/reactor/api-reference/ks.reactor/ks.reactor.ksshape.md).[ShapeTypes](/reactor/api-reference/ks.reactor/ks.reactor.ksshape/ks.reactor.ksshape.shapetypes.md)

## Methods

### GeometricCenter() <a href="#ks_reactor_client_unity_ksunitycollider_geometriccenter" id="ks_reactor_client_unity_ksunitycollider_geometriccenter"></a>

The geometric center of the collider in local space.

```csharp
public Vector3 GeometricCenter()
```

#### Returns

Vector3

Geometric center

### IsGeometryEqual(ksIUnityCollider) <a href="#ks_reactor_client_unity_ksunitycollider_isgeometryequal_ks_reactor_client_unity_ksiunitycollider" id="ks_reactor_client_unity_ksunitycollider_isgeometryequal_ks_reactor_client_unity_ksiunitycollider"></a>

Compare the geometry sources of each collider and return true if they are equal.

```csharp
public bool IsGeometryEqual(ksIUnityCollider other)
```

#### Parameters

`other` [ksIUnityCollider](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksiunitycollider.md)

Collider to compare to.

#### Returns

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

True if the collider geometry is equal.

### IsSupported(Collider) <a href="#ks_reactor_client_unity_ksunitycollider_issupported_unityengine_collider" id="ks_reactor_client_unity_ksunitycollider_issupported_unityengine_collider"></a>

Checks if a collider is one of the types Reactor supports.

```csharp
public static bool IsSupported(Collider collider)
```

#### Parameters

`collider` Collider

Collider to check

#### Returns

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

True if the collider is one of the supported types.

### Serialize() <a href="#ks_reactor_client_unity_ksunitycollider_serialize" id="ks_reactor_client_unity_ksunitycollider_serialize"></a>

Serializes the collider by shape type.

```csharp
public byte[] Serialize()
```

#### Returns

[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[]

Serialized shape.

### Volume() <a href="#ks_reactor_client_unity_ksunitycollider_volume" id="ks_reactor_client_unity_ksunitycollider_volume"></a>

Calculate the volume of the collider.

```csharp
public float Volume()
```

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

Volume of the collider.
