Class LSPolygonCollider2D
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
verticesVector2d[]
LSPolygonCollider2D(ColliderShapeDefinition2D)
Creates a runtime convex polygon from an authored shape definition.
public LSPolygonCollider2D(ColliderShapeDefinition2D definition)
Parameters
definitionColliderShapeDefinition2D
Properties
Count
Gets the polygon vertex count.
public int Count { get; }
Property Value
Shape
Gets the runtime pure 2D shape family.
public override ColliderType2D Shape { get; }
Property Value
Methods
ContainsPoint(Vector2d)
Gets whether a planar world-space point lies inside this collider.
public override bool ContainsPoint(Vector2d point)
Parameters
pointVector2d
Returns
GetClosestPoint(Vector2d)
Gets the closest representable point on this collider to a planar world-space point.
public override Vector2d GetClosestPoint(Vector2d point)
Parameters
pointVector2d
Returns
- Vector2d
GetSupportPoint(Vector2d)
Gets the farthest representable point along a planar world-space direction.
public override Vector2d GetSupportPoint(Vector2d direction)
Parameters
directionVector2d
Returns
- Vector2d
GetWorldVertex(int)
Gets a world-space vertex when the conceptual point is representable.
public Vector2d GetWorldVertex(int index)
Parameters
indexint
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
chroniclerIChronicler
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
indexintvertexVector2d