Table of Contents

Struct DistanceJointDefinition

Namespace
Box3D
Assembly
Box3D.NET.dll

Holds two points a set distance apart. The basis for ropes and springs.

public readonly record struct DistanceJointDefinition : IEquatable<DistanceJointDefinition>

Implements

Inherited Members

Examples

// A rope: free to sag, but never longer than three metres.
var rope = DistanceJointDefinition.Between(anchor, load, anchorPoint, loadPoint) with
{
    SpringEnabled = true,
    Hertz = 4.0f,
    DampingRatio = 0.5f,
    LimitsEnabled = true,
    MinLength = 0.1f,
    MaxLength = 3.0f,
};

Remarks

With Box3D.DistanceJointDefinition.SpringEnabled off the joint is rigid and both the limit and the motor are ignored. With it on, the limit becomes a rope that can go slack between Box3D.DistanceJointDefinition.MinLength and Box3D.DistanceJointDefinition.MaxLength.

Properties

Base

Gets the settings shared by every joint.

DampingRatio

Gets the spring damping ratio.

Default

Gets the engine defaults, with no bodies attached.

Hertz

Gets the spring stiffness in cycles per second.

Length

Gets the rest length, clamped to a stable minimum.

LimitsEnabled

Gets a value indicating whether the length limits are enforced.

LowerSpringForce

Gets the lower spring force, which bounds how much tension the joint sustains.

MaxLength

Gets the maximum length. Must be at least Box3D.DistanceJointDefinition.MinLength.

MaxMotorForce

Gets the maximum force the motor may apply, in newtons.

MinLength

Gets the minimum length.

MotorEnabled

Gets a value indicating whether the motor is enabled.

MotorSpeed

Gets the speed the motor drives towards, in metres per second.

SpringEnabled

Gets a value indicating whether the joint behaves as a spring rather than a rigid link.

UpperSpringForce

Gets the upper spring force, which bounds how much compression the joint sustains.

Methods

Between(Body, Body, Vector3, Vector3)

Connects a point on one body to a point on another, taking the current separation as the rest length.