Table of Contents

Struct CollisionGroup

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

This value follows up CollisionLayer when filtering out collisions. It prevents collisions between objects sharing the same Id, when the absolute difference between their IndexA, IndexB, and IndexC is less than two.

[DataContract]
public struct CollisionGroup
Inherited Members

Remarks

Example A: You have multiple characters (A, B, C, D) all with the same CollisionLayer, they are split in two teams {A, B} and {C, D}, but you don't want members of the same team to collide between each other, you can set {A, B}'s Id to 1 and {C, D}'s Id to 2.

Example B: You have a chain of three colliders attached to each other {A, B, C}, you don't want A and C to collide with B, but A and C should collide together. Set A, B and C's Ids to 1 to start filtering, leave A's IndexA at 0, B's to 1 and C to 2. A and C will collide since the difference between their IndexA is equal to two, but neither of them will collide with B since they are both only one away from B's index.

Fields

Id

The identification number used by this object, zero when you don't want to filter more than CollisionLayer already does.

public ushort Id

Field Value

ushort

Remarks

Set this value to the same number for all objects which should have their collisions ignored when colliding between each other.

IndexA

An index associated with this object in the collision group Id

[DataAlias("XAxis")]
public ushort IndexA

Field Value

ushort

Remarks

For a bunch of objects sharing the same Id, if the two objects have the same or subsequent values, collision between those two objects will be ignored. But, if their values are more than one apart, they will collide with each other.

IndexB

An index associated with this object in the collision group Id

[DataAlias("YAxis")]
public ushort IndexB

Field Value

ushort

Remarks

For a bunch of objects sharing the same Id, if the two objects have the same or subsequent values, collision between those two objects will be ignored. But, if their values are more than one apart, they will collide with each other.

IndexC

An index associated with this object in the collision group Id

[DataAlias("ZAxis")]
public ushort IndexC

Field Value

ushort

Remarks

For a bunch of objects sharing the same Id, if the two objects have the same or subsequent values, collision between those two objects will be ignored. But, if their values are more than one apart, they will collide with each other.