Struct ColliderShapeDefinition2D
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
Material
Gets the authored surface material used when this definition creates a runtime 2D collider directly.
public PhysicsMaterial Material { get; }
Property Value
PolygonVertexCount
Gets the number of local polygon vertices held by this definition.
public int PolygonVertexCount { get; }
Property Value
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
sizeVector2dmaterialPhysicsMaterial?
Returns
Capsule(Fixed64, Fixed64, PhysicsMaterial?)
Creates a vertical local-axis capsule shape definition.
public static ColliderShapeDefinition2D Capsule(Fixed64 radius, Fixed64 height, PhysicsMaterial? material = null)
Parameters
radiusFixed64heightFixed64materialPhysicsMaterial?
Returns
Circle(Fixed64, PhysicsMaterial?)
Creates a circle shape definition.
public static ColliderShapeDefinition2D Circle(Fixed64 radius, PhysicsMaterial? material = null)
Parameters
radiusFixed64materialPhysicsMaterial?
Returns
ConvexPolygon(params Vector2d[])
Creates a convex polygon shape definition.
public static ColliderShapeDefinition2D ConvexPolygon(params Vector2d[] vertices)
Parameters
verticesVector2d[]
Returns
ConvexPolygon(PhysicsMaterial?, params Vector2d[])
Creates a convex polygon shape definition.
public static ColliderShapeDefinition2D ConvexPolygon(PhysicsMaterial? material, params Vector2d[] vertices)
Parameters
materialPhysicsMaterial?verticesVector2d[]
Returns
CreateCollider()
Creates a new unbound runtime 2D collider from this shape definition.
public LSCollider2D CreateCollider()
Returns
Equals(ColliderShapeDefinition2D)
public bool Equals(ColliderShapeDefinition2D other)
Parameters
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
GetPolygonVertex(int)
Gets a local polygon vertex by stable source order.
public Vector2d GetPolygonVertex(int index)
Parameters
indexint
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
aVector2dbVector2dcVector2dmaterialPhysicsMaterial?
Returns
Operators
operator ==(ColliderShapeDefinition2D, ColliderShapeDefinition2D)
Determines whether two authored 2D shape definitions are equal.
public static bool operator ==(ColliderShapeDefinition2D left, ColliderShapeDefinition2D right)
Parameters
Returns
operator !=(ColliderShapeDefinition2D, ColliderShapeDefinition2D)
Determines whether two authored 2D shape definitions are not equal.
public static bool operator !=(ColliderShapeDefinition2D left, ColliderShapeDefinition2D right)