Table of Contents

Class LSPolygonCollider2D

Namespace
Gravitas.Colliders
Assembly
Gravitas.dll

Pure 2D convex polygon collider with deterministic vertex ordering.

public sealed class LSPolygonCollider2D : LSCollider2D, IRecordable
Inheritance
LSPolygonCollider2D
Implements
IRecordable
Inherited Members

Constructors

LSPolygonCollider2D(params Vector2d[])

Creates a pure 2D convex polygon from authored local vertices.

public LSPolygonCollider2D(params Vector2d[] vertices)

Parameters

vertices Vector2d[]

LSPolygonCollider2D(ColliderShapeDefinition2D)

Creates a runtime convex polygon from an authored shape definition.

public LSPolygonCollider2D(ColliderShapeDefinition2D definition)

Parameters

definition ColliderShapeDefinition2D

Properties

Count

Gets the polygon vertex count.

public int Count { get; }

Property Value

int

Shape

Gets the runtime pure 2D shape family.

public override ColliderType2D Shape { get; }

Property Value

ColliderType2D

Methods

ContainsPoint(Vector2d)

Gets whether a planar world-space point lies inside this collider.

public override bool ContainsPoint(Vector2d point)

Parameters

point Vector2d

Returns

bool

GetClosestPoint(Vector2d)

Gets the closest representable point on this collider to a planar world-space point.

public override Vector2d GetClosestPoint(Vector2d point)

Parameters

point Vector2d

Returns

Vector2d

GetSupportPoint(Vector2d)

Gets the farthest representable point along a planar world-space direction.

public override Vector2d GetSupportPoint(Vector2d direction)

Parameters

direction Vector2d

Returns

Vector2d

GetWorldVertex(int)

Gets a world-space vertex when the conceptual point is representable.

public Vector2d GetWorldVertex(int index)

Parameters

index int

Returns

Vector2d

Exceptions

InvalidOperationException

Thrown when the conceptual vertex lies outside the fixed-point scalar domain. Use TryGetWorldVertex(int, out Vector2d) when querying geometry near a scalar boundary.

RecordShapeData(IChronicler)

Records derived authored shape data.

protected override void RecordShapeData(IChronicler chronicler)

Parameters

chronicler IChronicler

TryGetWorldVertex(int, out Vector2d)

Attempts to materialize a committed polygon vertex in world space without saturation.

public bool TryGetWorldVertex(int index, out Vector2d vertex)

Parameters

index int
vertex Vector2d

Returns

bool