Table of Contents

Struct VolumeConstraint

Namespace
BepuPhysics.Constraints
Assembly
BepuPhysics.dll

Constrains the volume of a tetrahedron connecting the centers of four bodies to match a goal volume. Scaled volume computed from (ab x ac) * ad; the volume may be negative depending on the winding of the tetrahedron.

public struct VolumeConstraint : IFourBodyConstraintDescription<VolumeConstraint>, IConstraintDescription<VolumeConstraint>
Implements
Inherited Members

Constructors

VolumeConstraint(Vector3, Vector3, Vector3, Vector3, SpringSettings)

Creates a new volume constraint, initializing the target volume using a set of initial positions.

public VolumeConstraint(Vector3 a, Vector3 b, Vector3 c, Vector3 d, SpringSettings springSettings)

Parameters

a Vector3

Initial position of the first body.

b Vector3

Initial position of the second body.

c Vector3

Initial position of the third body.

d Vector3

Initial position of the fourth body.

springSettings SpringSettings

Spring settings to apply to the volume constraint.

Fields

SpringSettings

Spring frequency and damping parameters.

public SpringSettings SpringSettings

Field Value

SpringSettings

TargetScaledVolume

6 times the target volume of the tetrahedra. Computed from (ab x ac) * ad; this may be negative depending on the winding of the tetrahedron.

public float TargetScaledVolume

Field Value

float

Properties

ConstraintTypeId

Gets the type id of the constraint that this is a description of.

public static int ConstraintTypeId { get; }

Property Value

int

TypeProcessorType

Gets the type of the type batch which contains described constraints.

public static Type TypeProcessorType { get; }

Property Value

Type

Methods

ApplyDescription(ref TypeBatch, int, int)

Changes the batch-held memory at a given location to match the given description.

public readonly void ApplyDescription(ref TypeBatch batch, int bundleIndex, int innerIndex)

Parameters

batch TypeBatch

Batch to modify.

bundleIndex int

Index of the target constraint's bundle.

innerIndex int

Index of the target constraint within its bundle.

BuildDescription(ref TypeBatch, int, int, out VolumeConstraint)

Creates a description from the batch-held memory at a given location.

public static void BuildDescription(ref TypeBatch batch, int bundleIndex, int innerIndex, out VolumeConstraint description)

Parameters

batch TypeBatch

Batch to read.

bundleIndex int

Index of the source constraint's bundle.

innerIndex int

Index of the source constraint within its bundle.

description VolumeConstraint

Description of the constraint.

CreateTypeProcessor()

Creates a type processor for this constraint type.

public static TypeProcessor CreateTypeProcessor()

Returns

TypeProcessor