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
Vector3Initial position of the first body.
b
Vector3Initial position of the second body.
c
Vector3Initial position of the third body.
d
Vector3Initial position of the fourth body.
springSettings
SpringSettingsSpring settings to apply to the volume constraint.
Fields
SpringSettings
Spring frequency and damping parameters.
public SpringSettings SpringSettings
Field Value
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
Properties
ConstraintTypeId
Gets the type id of the constraint that this is a description of.
public static int ConstraintTypeId { get; }
Property Value
TypeProcessorType
Gets the type of the type batch which contains described constraints.
public static Type TypeProcessorType { get; }
Property Value
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
TypeBatchBatch to modify.
bundleIndex
intIndex of the target constraint's bundle.
innerIndex
intIndex 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
TypeBatchBatch to read.
bundleIndex
intIndex of the source constraint's bundle.
innerIndex
intIndex of the source constraint within its bundle.
description
VolumeConstraintDescription of the constraint.
CreateTypeProcessor()
Creates a type processor for this constraint type.
public static TypeProcessor CreateTypeProcessor()