Table of Contents

Class CollidableComponent

Namespace
Stride.BepuPhysics
Assembly
Stride.BepuPhysics.dll
[DataContract(Inherited = true)]
[DefaultEntityComponentProcessor(typeof(CollidableProcessor), ExecutionMode = ExecutionMode.Runtime)]
public abstract class CollidableComponent : EntityComponent, IIdentifiable
Inheritance
CollidableComponent
Implements
Derived
Inherited Members

Constructors

CollidableComponent()

public CollidableComponent()

Properties

CenterOfMass

The center of mass of this object

public Vector3 CenterOfMass { get; }

Property Value

Vector3

Remarks

This property will always return Zero if this object is not part of a simulation yet.

Collider

The collider definition used by this object.

[Display(null, null, Expand = ExpandRule.Always)]
public required ICollider Collider { get; set; }

Property Value

ICollider

Remarks

Changing this value will reset some of the internal physics state of this body

CollisionGroup

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.

[DataAlias("FilterByDistance")]
public CollisionGroup CollisionGroup { get; set; }

Property Value

CollisionGroup

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.

CollisionLayer

Controls how this object interacts with other objects, allow or prevent collisions between it and other groups based on how CollisionMatrix is set up.

[DataAlias("CollisionMask")]
public CollisionLayer CollisionLayer { get; set; }

Property Value

CollisionLayer

ContactEventHandler

Provides the ability to collect and mutate contact data when this object collides with other objects.

public IContactEventHandler? ContactEventHandler { get; set; }

Property Value

IContactEventHandler

FrictionCoefficient

public float FrictionCoefficient { get; set; }

Property Value

float

MaterialProperties

protected abstract ref MaterialProperties MaterialProperties { get; }

Property Value

MaterialProperties

MaximumRecoveryVelocity

public float MaximumRecoveryVelocity { get; set; }

Property Value

float

Pose

protected abstract RigidPose? Pose { get; }

Property Value

RigidPose?

ShapeIndex

protected TypedIndex ShapeIndex { get; }

Property Value

TypedIndex

Simulation

The simulation this object belongs to, null when it is not part of a simulation.

public BepuSimulation? Simulation { get; }

Property Value

BepuSimulation

SimulationSelector

[DefaultValueIsSceneBased]
public ISimulationSelector SimulationSelector { get; set; }

Property Value

ISimulationSelector

SpringDampingRatio

public float SpringDampingRatio { get; set; }

Property Value

float

SpringFrequency

public float SpringFrequency { get; set; }

Property Value

float

Methods

AttachInner(RigidPose, BodyInertia, TypedIndex)

Called every time this is added to a simulation

protected abstract void AttachInner(RigidPose pose, BodyInertia shapeInertia, TypedIndex shapeIndex)

Parameters

pose RigidPose
shapeInertia BodyInertia
shapeIndex TypedIndex

Remarks

May occur when certain larger changes are made to the object, Simulation is the one this object is being added to

DetachInner()

Called every time this is removed from the simulation

protected abstract void DetachInner()

Remarks

May occur right before AttachInner(RigidPose, BodyInertia, TypedIndex) when certain larger changes are made to the object, Simulation is the one this object was on prior to detaching

GetHandleValue()

protected abstract int GetHandleValue()

Returns

int

IsContactHandlerRegistered()

protected abstract bool IsContactHandlerRegistered()

Returns

bool

RegisterContactHandler()

protected abstract void RegisterContactHandler()

TryUpdateMaterialProperties()

protected void TryUpdateMaterialProperties()

UnregisterContactHandler()

protected abstract void UnregisterContactHandler()