UpdateSegments(Span<ChainSegmentGeometry>, ReadOnlySpan<Vector2>, PhysicsTransform, bool)
Update an existing batch of ChainSegmentGeometry from a set of vertices, writing the results into the specified span in place. This pairs with ChainSegmentGeometry.CreateSegments: 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.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
public static void UpdateSegments(Span<ChainSegmentGeometry> segments, ReadOnlySpan<Vector2> vertices, PhysicsTransform transform, bool isLoop)
Parameters
The segment batch to update in place. Its length must equal the segment count the vertices produce.
The vertices to recalculate the segments from.
The transform used to specify where the geometry is positioned.
Indicates a closed chain formed by connecting the first and last vertices specified. This changes how the vertices are interpreted.