> 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.ksshapeutils.md).

# Class ksShapeUtils

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

Collision shape utils.

```csharp
public class ksShapeUtils
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) â† [ksShapeUtils](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksshapeutils.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)

## Methods

### AxisToRotationOffset(Axis) <a href="#ks_reactor_client_unity_ksshapeutils_axistorotationoffset_ks_reactor_ksshape_axis" id="ks_reactor_client_unity_ksshapeutils_axistorotationoffset_ks_reactor_ksshape_axis"></a>

Converts enum [Axis](/reactor/api-reference/ks.reactor/ks.reactor.ksshape/ks.reactor.ksshape.axis.md) to a ksQuaternion that would rotate a y-axis aligned shape to the given axis.

```csharp
public static ksQuaternion AxisToRotationOffset(ksShape.Axis axis)
```

#### Parameters

`axis` [ksShape](/reactor/api-reference/ks.reactor/ks.reactor.ksshape.md).[Axis](/reactor/api-reference/ks.reactor/ks.reactor.ksshape/ks.reactor.ksshape.axis.md)

Axis alignment

#### Returns

[ksQuaternion](/reactor/api-reference/ks.reactor/ks.reactor.ksquaternion.md)

Quaternion representing axis rotated from the identity rotation.

### CreateApproximateShape(ksVector3) <a href="#ks_reactor_client_unity_ksshapeutils_createapproximateshape_ks_reactor_ksvector3" id="ks_reactor_client_unity_ksshapeutils_createapproximateshape_ks_reactor_ksvector3"></a>

Creates a capsule or sphere to approximate box extents. A capsule will be created if the largest extent is at least twice as long as the next largest.

```csharp
public static ksShape CreateApproximateShape(ksVector3 extents)
```

#### Parameters

`extents` [ksVector3](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3.md)

Extents to create an approximate shape for.

#### Returns

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

Approximate shape

### GetCapsuleEndPoints(ksCapsule, ksVector3, ksQuaternion, out ksVector3, out ksVector3) <a href="#ks_reactor_client_unity_ksshapeutils_getcapsuleendpoints_ks_reactor_kscapsule_ks_reactor_ksvector3_k" id="ks_reactor_client_unity_ksshapeutils_getcapsuleendpoints_ks_reactor_kscapsule_ks_reactor_ksvector3_k"></a>

Gets the center of two spheres on either end of a capsule.

```csharp
public static void GetCapsuleEndPoints(ksCapsule capsule, ksVector3 position, ksQuaternion rotation, out ksVector3 point1, out ksVector3 point2)
```

#### Parameters

`capsule` [ksCapsule](/reactor/api-reference/ks.reactor/ks.reactor.kscapsule.md)

Capsule

`position` [ksVector3](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3.md)

Position

`rotation` [ksQuaternion](/reactor/api-reference/ks.reactor/ks.reactor.ksquaternion.md)

Rotation

`point1` [ksVector3](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3.md)

Point1

`point2` [ksVector3](/reactor/api-reference/ks.reactor/ks.reactor.ksvector3.md)

Point2

### GetColliderShape(ksIUnityCollider, bool) <a href="#ks_reactor_client_unity_ksshapeutils_getcollidershape_ks_reactor_client_unity_ksiunitycollider_syste" id="ks_reactor_client_unity_ksshapeutils_getcollidershape_ks_reactor_client_unity_ksiunitycollider_syste"></a>

Gets the [ksShape](/reactor/api-reference/ks.reactor/ks.reactor.ksshape.md) representation of a collider to use for queries. Mesh colliders are approximated as spheres or capsules.

```csharp
public static ksShape GetColliderShape(ksIUnityCollider collider, bool suppressWarnings = false)
```

#### Parameters

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

Collider

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

If true, will not log warnings when an sphere or capsule is used to approximate an unsupported collider.

#### Returns

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

Collider shape
