Table of Contents

Method GetShapes

Namespace
Box3D
Assembly
Box3D.NET.dll

GetShapes(Span<Shape>)

Copies the handles of every shape on this body into the supplied span.

public int GetShapes(Span<Shape> destination)

Parameters

destination Span<Shape>

Receives the shapes. Size it with Box3D.Body.ShapeCount; a shorter span is filled as far as it goes.

Returns

int

The number of shapes written.

Examples

Span<Shape> shapes = stackalloc Shape[body.ShapeCount];
int count = body.GetShapes(shapes);
foreach (Shape shape in shapes[..count])
{
    shape.Friction = 0.1f;
}

Remarks

Takes a caller-provided span rather than returning an array, so that a per-frame walk over shapes allocates nothing.