Table of Contents

Class BodyComponent

Namespace
Stride.BepuPhysics
Assembly
Stride.BepuPhysics.dll
[ComponentCategory("Physics - Bepu")]
public class BodyComponent : CollidableComponent, IIdentifiable
Inheritance
BodyComponent
Implements
Derived
Inherited Members

Properties

AngularVelocity

The rotation velocity in unit per second

public Vector3 AngularVelocity { get; set; }

Property Value

Vector3

Remarks

The rotation format is in axis-angle, meaning that AngularVelocity.Normalized is the axis of rotation, while AngularVelocity.Length is the amount of rotation around that axis in radians per second

Awake

Whether the body is being actively simulated. Setting this to true will attempt to wake the body; setting it to false will force the body and any constraint-connected bodies asleep.

public bool Awake { get; set; }

Property Value

bool

BodyInertia

The mass and inertia tensor of this body

public BodyInertia BodyInertia { get; set; }

Property Value

BodyInertia

Constraints

The constraints targeting this body, some of those may not be Attached

public IReadOnlyList<ConstraintComponentBase> Constraints { get; }

Property Value

IReadOnlyList<ConstraintComponentBase>

ContinuousDetection

Defines how a collidable handles collisions with significant velocity.

public ContinuousDetection ContinuousDetection { get; set; }

Property Value

ContinuousDetection

ContinuousDetectionMode

Whether the object's path or only its destination is checked for collision when moving, prevents objects from passing through each other at higher speed

public ContinuousDetectionMode ContinuousDetectionMode { get; set; }

Property Value

ContinuousDetectionMode

Remarks

This property is a shortcut to the ContinuousDetection.BepuPhysics.Collidables.ContinuousDetection.Mode property

Gravity

Whether gravity should affect the simulation's PoseGravity

public bool Gravity { get; set; }

Property Value

bool

Remarks

Gravity is always active if UsePerBodyAttributes is false

InterpolationMode

Controls whether and how the motion of this body is smoothed out between physics update

public InterpolationMode InterpolationMode { get; set; }

Property Value

InterpolationMode

Kinematic

When kinematic is set, the object will not be affected by physics forces like gravity or collisions but will still push away bodies it collides with.

public bool Kinematic { get; set; }

Property Value

bool

LinearVelocity

The translation velocity in unit per second

public Vector3 LinearVelocity { get; set; }

Property Value

Vector3

MaterialProperties

protected override ref MaterialProperties MaterialProperties { get; }

Property Value

MaterialProperties

MinimumTimestepCountUnderThreshold

The number of time steps that the body must be under the sleep threshold before the body becomes a sleeping candidate. Note that the body is not guaranteed to go to sleep immediately after meeting this minimum.

public byte MinimumTimestepCountUnderThreshold { get; set; }

Property Value

byte

Orientation

The rotation of this body in the physics scene, setting it will 'teleport' this object's rotation to the one provided.

public Quaternion Orientation { get; set; }

Property Value

Quaternion

Remarks

Using this property to move objects around is not recommended, as it disregards any collider that may overlap with the body at this new orientation, you should make sure the area is clear to ensure this object does not become stuck in the scenery.

Pose

protected override RigidPose? Pose { get; }

Property Value

RigidPose?

Position

The position of this body in the physics scene, setting it will teleport this object to the positoin provided.

public Vector3 Position { get; set; }

Property Value

Vector3

Remarks

Using this property to move objects around is not recommended, as it disregards any collider that may overlap with the body at this new position, you should make sure the area is clear to ensure this object does not become stuck in the scenery.

SleepThreshold

Threshold of squared combined velocity under which the body is allowed to go to sleep. Setting this to a negative value guarantees the body cannot go to sleep without user action.

public float SleepThreshold { get; set; }

Property Value

float

SpeculativeMargin

public float SpeculativeMargin { get; set; }

Property Value

float

Methods

ApplyAngularImpulse(Vector3)

Applies an explosive force which will only affect this body's angular velocity

public void ApplyAngularImpulse(Vector3 impulse)

Parameters

impulse Vector3

Remarks

Does not wake the body up

ApplyImpulse(Vector3, Vector3)

Applies an explosive force at a specific offset off of this body which will affect both its angular and linear velocity

public void ApplyImpulse(Vector3 impulse, Vector3 impulseOffset)

Parameters

impulse Vector3

Impulse to apply to the velocity

impulseOffset Vector3

World space offset from the center of the body to apply the impulse at

Remarks

Does not wake the body up

ApplyLinearImpulse(Vector3)

Applies an explosive force which will only affect this body's linear velocity

public void ApplyLinearImpulse(Vector3 impulse)

Parameters

impulse Vector3

Remarks

Does not wake the body up

AttachInner(RigidPose, BodyInertia, TypedIndex)

Called every time this is added to a simulation

protected override 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 override 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 override int GetHandleValue()

Returns

int

IsContactHandlerRegistered()

protected override bool IsContactHandlerRegistered()

Returns

bool

RegisterContactHandler()

protected override void RegisterContactHandler()

UnregisterContactHandler()

protected override void UnregisterContactHandler()