# ChainSegmentGeometry

> The geometry of a chain line segment with one-sided collision which only collides on the "right" side. Several of these are generated for a chain, connected as ghost1 -\> point1 -\> point2 -\> ghost2.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule
* **Implements:** [IEquatable\<ChainSegmentGeometry>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct ChainSegmentGeometry : IEquatable<ChainSegmentGeometry>
```

## Static Fields

| Value                                                                                                        | Description                    |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------ |
| [defaultGeometry](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/defaultgeometry.md) | Get the default Chain Segment. |

## Constructors

| Constructor                                                                                                                                                                                                                               | Description                                                                                                                                        |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ChainSegmentGeometry()](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/ctor.md#chainsegmentgeometry\(\))                                                                                                         | Create a default ChainSegment. See [\_defaultGeometry](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/defaultgeometry.md). |
| [ChainSegmentGeometry(Unity.U2D.Physics.SegmentGeometry,UnityEngine.Vector2,UnityEngine.Vector2)](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/ctor.md#chainsegmentgeometry\(segmentgeometry-vector2-vector2\)) | Create a default ChainSegment.                                                                                                                     |

## Properties

| Property                                                                                                 | Description                                                                                                                                                               |
| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [areEdgesValid](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/areedgesvalid.md) | Whether the two points defining [\_segment](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/segment.md) are far enough apart to form a valid edge. |
| [ghost1](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/ghost1.md)               | The tail ghost vertex. A ghost vertex is used by the solver to define how a collision response should be handled when a contact with the vertex occurs.                   |
| [ghost2](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/ghost2.md)               | The head ghost vertex A ghost vertex is used by the solver to define how a collision response should be handled when a contact with the vertex occurs.                    |
| [isValid](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/isvalid.md)             | Whether the geometry describes a chain segment that can be used.                                                                                                          |
| [segment](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/segment.md)             | The Segment.                                                                                                                                                              |

## Methods

| Method                                                                                                         | Description                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CalculateAABB](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/calculateaabb.md)       | Calculate the AABB of the geometry.                                                                                                                                                                                                                                                                                                                                                                     |
| [CastRay](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/castray.md)                   | Calculate if a world ray intersects the geometry. See [PhysicsQuery.CastResult](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/castresult.md).                                                                                                                                                                                                                                          |
| [CastShape](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/castshape.md)               | Calculate if a cast shape intersects the geometry. Initially touching shapes are treated as a miss. You should check for overlap first if initial overlap is required. See [PhysicsQuery.CastShapeInput](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/castshapeinput.md) and [PhysicsQuery.CastResult](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/castresult.md). |
| [ClosestPoint](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/closestpoint.md)         | Calculate the closest point on this geometry to the specified point.                                                                                                                                                                                                                                                                                                                                    |
| [CreateShapeProxy](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/createshapeproxy.md) | Create a shape proxy from the geometry.                                                                                                                                                                                                                                                                                                                                                                 |
| [InverseTransform](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/inversetransform.md) | Inverse-Transform the geometry.                                                                                                                                                                                                                                                                                                                                                                         |
| [Transform](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/transform.md)               | Transform the geometry.                                                                                                                                                                                                                                                                                                                                                                                 |

## Static Methods

| Method                                                                                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CreateSegments](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/createsegments.md)     | Create multiple [ChainSegmentGeometry](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry.md) from a set of vertices. The rules for interpreting the specified vertices when creating segments is described in [PhysicsChain](/engine/6000.7/script-reference/unity/u2d/physics/physicschain.md).                                                                                                                                                                                                                                                                                                                             |
| [InverseTransform](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/inversetransform.md) | Inverse-Transform a batch of geometry in place.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [Transform](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/transform.md)               | Transform a batch of geometry in place.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [UpdateSegments](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/updatesegments.md)     | Update an existing batch of [ChainSegmentGeometry](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry.md) from a set of vertices, writing the results into the specified span in place. This pairs with [ChainSegmentGeometry.CreateSegments](/engine/6000.7/script-reference/unity/u2d/physics/chainsegmentgeometry/createsegments.md): it recalculates the same segment and ghost vertices, but reuses a caller-provided span rather than allocating a new one. The span length must equal the segment count the vertices produce, which is the vertex count when `isLoop` is true, otherwise the vertex count minus three. |
