Table of Contents

Struct ColliderShapeDefinition2D

Namespace
Gravitas.Colliders
Assembly
Gravitas.dll

Describes authoritative pure 2D collider shape input without runtime collider lifecycle state such as IDs, bodies, partitions, pairs, or events.

public readonly struct ColliderShapeDefinition2D : IEquatable<ColliderShapeDefinition2D>
Implements
Inherited Members

Properties

Kind

Gets the shape family represented by this definition.

public ColliderShapeDefinition2DKind Kind { get; }

Property Value

ColliderShapeDefinition2DKind

Material

Gets the authored surface material used when this definition creates a runtime 2D collider directly.

public PhysicsMaterial Material { get; }

Property Value

PhysicsMaterial

PolygonVertexCount

Gets the number of local polygon vertices held by this definition.

public int PolygonVertexCount { get; }

Property Value

int

Radius

Gets the unscaled radius used by circle definitions.

public Fixed64 Radius { get; }

Property Value

Fixed64

Size

Gets the unscaled size used by sized definitions.

public Vector2d Size { get; }

Property Value

Vector2d

Methods

AABBox(Vector2d, PhysicsMaterial?)

Creates an axis-aligned box shape definition.

public static ColliderShapeDefinition2D AABBox(Vector2d size, PhysicsMaterial? material = null)

Parameters

size Vector2d
material PhysicsMaterial?

Returns

ColliderShapeDefinition2D

Capsule(Fixed64, Fixed64, PhysicsMaterial?)

Creates a vertical local-axis capsule shape definition.

public static ColliderShapeDefinition2D Capsule(Fixed64 radius, Fixed64 height, PhysicsMaterial? material = null)

Parameters

radius Fixed64
height Fixed64
material PhysicsMaterial?

Returns

ColliderShapeDefinition2D

Circle(Fixed64, PhysicsMaterial?)

Creates a circle shape definition.

public static ColliderShapeDefinition2D Circle(Fixed64 radius, PhysicsMaterial? material = null)

Parameters

radius Fixed64
material PhysicsMaterial?

Returns

ColliderShapeDefinition2D

ConvexPolygon(params Vector2d[])

Creates a convex polygon shape definition.

public static ColliderShapeDefinition2D ConvexPolygon(params Vector2d[] vertices)

Parameters

vertices Vector2d[]

Returns

ColliderShapeDefinition2D

ConvexPolygon(PhysicsMaterial?, params Vector2d[])

Creates a convex polygon shape definition.

public static ColliderShapeDefinition2D ConvexPolygon(PhysicsMaterial? material, params Vector2d[] vertices)

Parameters

material PhysicsMaterial?
vertices Vector2d[]

Returns

ColliderShapeDefinition2D

CreateCollider()

Creates a new unbound runtime 2D collider from this shape definition.

public LSCollider2D CreateCollider()

Returns

LSCollider2D

Equals(ColliderShapeDefinition2D)

public bool Equals(ColliderShapeDefinition2D other)

Parameters

other ColliderShapeDefinition2D

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

GetPolygonVertex(int)

Gets a local polygon vertex by stable source order.

public Vector2d GetPolygonVertex(int index)

Parameters

index int

Returns

Vector2d

Triangle(Vector2d, Vector2d, Vector2d, PhysicsMaterial?)

Creates a triangle authoring definition backed by the convex-polygon runtime shape.

public static ColliderShapeDefinition2D Triangle(Vector2d a, Vector2d b, Vector2d c, PhysicsMaterial? material = null)

Parameters

a Vector2d
b Vector2d
c Vector2d
material PhysicsMaterial?

Returns

ColliderShapeDefinition2D

Operators

operator ==(ColliderShapeDefinition2D, ColliderShapeDefinition2D)

Determines whether two authored 2D shape definitions are equal.

public static bool operator ==(ColliderShapeDefinition2D left, ColliderShapeDefinition2D right)

Parameters

left ColliderShapeDefinition2D
right ColliderShapeDefinition2D

Returns

bool

operator !=(ColliderShapeDefinition2D, ColliderShapeDefinition2D)

Determines whether two authored 2D shape definitions are not equal.

public static bool operator !=(ColliderShapeDefinition2D left, ColliderShapeDefinition2D right)

Parameters

left ColliderShapeDefinition2D
right ColliderShapeDefinition2D

Returns

bool