Table of Contents

Struct ColliderShapeDefinition

Namespace
Gravitas.Colliders
Assembly
Gravitas.dll

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

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

Properties

Height

Gets the unscaled height used by capsule and finite-cylinder shapes.

public Fixed64 Height { get; }

Property Value

Fixed64

Kind

Gets the shape family represented by this definition.

public ColliderShapeDefinitionKind Kind { get; }

Property Value

ColliderShapeDefinitionKind

Material

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

public PhysicsMaterial Material { get; }

Property Value

PhysicsMaterial

MeshInertiaPolicy

Gets the inertia policy used when this definition represents a convex mesh.

public MeshInertiaPolicy MeshInertiaPolicy { get; }

Property Value

MeshInertiaPolicy

MeshTriangleIndexCount

Gets the number of triangle indices held by a convex mesh definition.

public int MeshTriangleIndexCount { get; }

Property Value

int

MeshVertexCount

Gets the number of local mesh vertices held by a convex mesh definition.

public int MeshVertexCount { get; }

Property Value

int

Radius

Gets the unscaled radius used by radius-based shapes.

public Fixed64 Radius { get; }

Property Value

Fixed64

Size

Gets the unscaled size used by sized shapes. Radius-based definitions store their normalized runtime size here as well.

public Vector3d Size { get; }

Property Value

Vector3d

Methods

Capsule(Fixed64, Fixed64, PhysicsMaterial?)

Creates a capsule shape definition.

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

Parameters

radius Fixed64
height Fixed64
material PhysicsMaterial?

Returns

ColliderShapeDefinition

Cone(Fixed64, Fixed64, PhysicsMaterial?)

Creates a finite circular cone shape definition whose local origin is the bounding center between its base plane and apex.

public static ColliderShapeDefinition Cone(Fixed64 radius, Fixed64 height, PhysicsMaterial? material = null)

Parameters

radius Fixed64
height Fixed64
material PhysicsMaterial?

Returns

ColliderShapeDefinition

ConvexMesh(Vector3d[], int[], MeshInertiaPolicy, PhysicsMaterial?)

Creates a convex mesh shape definition.

public static ColliderShapeDefinition ConvexMesh(Vector3d[] vertices, int[] triangles, MeshInertiaPolicy inertiaPolicy = MeshInertiaPolicy.RequireClosedVolume, PhysicsMaterial? material = null)

Parameters

vertices Vector3d[]
triangles int[]
inertiaPolicy MeshInertiaPolicy
material PhysicsMaterial?

Returns

ColliderShapeDefinition

CreateCollider()

Creates a new unbound runtime collider from this shape definition.

public LSCollider CreateCollider()

Returns

LSCollider

Cuboid(Vector3d, PhysicsMaterial?)

Creates a cuboid shape definition.

public static ColliderShapeDefinition Cuboid(Vector3d size, PhysicsMaterial? material = null)

Parameters

size Vector3d
material PhysicsMaterial?

Returns

ColliderShapeDefinition

Cylinder(Fixed64, Fixed64, PhysicsMaterial?)

Creates a finite-cylinder shape definition.

public static ColliderShapeDefinition Cylinder(Fixed64 radius, Fixed64 height, PhysicsMaterial? material = null)

Parameters

radius Fixed64
height Fixed64
material PhysicsMaterial?

Returns

ColliderShapeDefinition

Equals(ColliderShapeDefinition)

public bool Equals(ColliderShapeDefinition other)

Parameters

other ColliderShapeDefinition

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

GetMeshTriangleIndex(int)

Gets a mesh triangle index by stable source order.

public int GetMeshTriangleIndex(int index)

Parameters

index int

Returns

int

GetMeshVertex(int)

Gets a local mesh vertex by stable source order.

public Vector3d GetMeshVertex(int index)

Parameters

index int

Returns

Vector3d

Sphere(Fixed64, PhysicsMaterial?)

Creates a sphere shape definition.

public static ColliderShapeDefinition Sphere(Fixed64 radius, PhysicsMaterial? material = null)

Parameters

radius Fixed64
material PhysicsMaterial?

Returns

ColliderShapeDefinition

Operators

operator ==(ColliderShapeDefinition, ColliderShapeDefinition)

Determines whether two authored 3D shape definitions are equal.

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

Parameters

left ColliderShapeDefinition
right ColliderShapeDefinition

Returns

bool

operator !=(ColliderShapeDefinition, ColliderShapeDefinition)

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

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

Parameters

left ColliderShapeDefinition
right ColliderShapeDefinition

Returns

bool