Table of Contents

Struct SphericalJointDefinition

Namespace
Box3D
Assembly
Box3D.NET.dll

A ball-in-socket: the bodies share a point and may rotate freely about it, within optional cone and twist limits.

public readonly record struct SphericalJointDefinition : IEquatable<SphericalJointDefinition>

Implements

Inherited Members

Examples

// A shoulder: swings within a 60 degree cone, twists a quarter turn either way.
var shoulder = SphericalJointDefinition.BallAndSocket(torso, arm, shoulderPoint) with
{
    ConeLimitEnabled = true,
    ConeAngle = MathF.PI / 3.0f,
    TwistLimitEnabled = true,
    LowerTwistAngle = -MathF.PI / 4.0f,
    UpperTwistAngle = MathF.PI / 4.0f,
};

Remarks

The cone limits how far the frame B z axis may swing away from the frame A z axis; the twist limits rotation about that axis. Together they are what makes a believable shoulder or hip in a ragdoll.

Properties

Base

Gets the settings shared by every joint.

ConeAngle

Gets the cone half angle in radians, from zero to pi.

ConeLimitEnabled

Gets a value indicating whether the cone limit is enforced.

DampingRatio

Gets the spring damping ratio. Non-negative.

Default

Gets the engine defaults, with no bodies attached.

Hertz

Gets the spring stiffness in cycles per second. Non-negative.

LowerTwistAngle

Gets the lower twist limit in radians. At least minus 0.99 pi.

MaxMotorTorque

Gets the maximum torque the motor may apply, in newton-metres.

MotorEnabled

Gets a value indicating whether the motor is enabled.

MotorVelocity

Gets the angular velocity the motor drives towards, in radians per second.

SpringEnabled

Gets a value indicating whether a spring pulls the two frames into alignment.

TargetRotation

Gets the rotation of frame B relative to frame A that the spring drives towards.

TwistLimitEnabled

Gets a value indicating whether the twist limit is enforced.

UpperTwistAngle

Gets the upper twist limit in radians. At most 0.99 pi.

Methods

BallAndSocket(Body, Body, Vector3, Vector3?)

Pins two bodies together at a shared world-space point.