Table of Contents

Struct CollisionMatrix

Namespace
Stride.BepuPhysics.Definitions
Assembly
Stride.BepuPhysics.dll

Defines how layers collide between each other.

public struct CollisionMatrix : IEquatable<CollisionMatrix>
Implements
Inherited Members

Remarks

This structure is VERY large, prefer referencing it directly instead of passing it around.

Fields

All

public static CollisionMatrix All

Field Value

CollisionMatrix

DataBits

public const int DataBits = 528

Field Value

int

DataLength

public const int DataLength = 17

Field Value

int

Methods

Equals(CollisionMatrix)

Indicates whether the current object is equal to another object of the same type.

public readonly bool Equals(CollisionMatrix other)

Parameters

other CollisionMatrix

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Get(CollisionLayer)

Return all layers colliding with a given layer

public readonly CollisionMask Get(CollisionLayer layer)

Parameters

layer CollisionLayer

Returns

CollisionMask

Remarks

Prefer Get(CollisionLayer, CollisionLayer) over this one when checking a single layer

Get(CollisionLayer, CollisionLayer)

Returns whether two layers would collide with each other

public readonly bool Get(CollisionLayer layer1, CollisionLayer layer2)

Parameters

layer1 CollisionLayer
layer2 CollisionLayer

Returns

bool

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

LayersToIndex(CollisionLayer, CollisionLayer)

public static int LayersToIndex(CollisionLayer layer1, CollisionLayer layer2)

Parameters

layer1 CollisionLayer
layer2 CollisionLayer

Returns

int

Set(CollisionLayer, CollisionLayer, bool)

Set whether two layers should collide with each other

public void Set(CollisionLayer layer1, CollisionLayer layer2, bool shouldCollide)

Parameters

layer1 CollisionLayer
layer2 CollisionLayer
shouldCollide bool

Set(CollisionLayer, CollisionMask)

Set all layers that should collide with a given layer

public void Set(CollisionLayer layer, CollisionMask mask)

Parameters

layer CollisionLayer
mask CollisionMask

Remarks

Prefer Set(CollisionLayer, CollisionLayer, bool) over this one when setting one or two layers

Operators

operator ==(CollisionMatrix, CollisionMatrix)

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

Parameters

left CollisionMatrix
right CollisionMatrix

Returns

bool

operator !=(CollisionMatrix, CollisionMatrix)

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

Parameters

left CollisionMatrix
right CollisionMatrix

Returns

bool