Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

ChainSegmentGeometry.UpdateSegments

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void UpdateSegments(Span<ChainSegmentGeometry> segments, ReadOnlySpan<Vector2> vertices, PhysicsTransform transform, bool isLoop);

Parameters

Parameter Description
segments The segment batch to update in place. Its length must equal the segment count the vertices produce.
vertices The vertices to recalculate the segments from.
transform The transform used to specify where the geometry is positioned.
isLoop Indicates a closed chain formed by connecting the first and last vertices specified. This changes how the vertices are interpreted.

Description

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.