Table of Contents

Class BallSocket

Namespace
Jitter2.Dynamics.Constraints
Assembly
Jitter2.dll

Implements a ball-and-socket joint that anchors a point on each body together, removing three translational degrees of freedom.

public class BallSocket : Constraint<BallSocket.BallSocketData>, IDebugDrawable
Inheritance
BallSocket
Implements
Inherited Members

Properties

Anchor1

Gets or sets the anchor point on the first rigid body in world space. The anchor point is fixed in the local reference frame of the first body.

[ReferenceFrame(ReferenceFrame.World)]
public JVector Anchor1 { get; set; }

Property Value

JVector

Anchor2

Gets or sets the anchor point on the second rigid body in world space. The anchor point is fixed in the local reference frame of the second body.

[ReferenceFrame(ReferenceFrame.World)]
public JVector Anchor2 { get; set; }

Property Value

JVector

Bias

Gets or sets the bias factor controlling how aggressively positional error is corrected.

public float Bias { get; set; }

Property Value

float

Default is 0.2. Range [0, 1]. Higher values correct errors faster but may cause instability.

Impulse

Gets the accumulated impulse applied by this constraint during the last step.

public JVector Impulse { get; }

Property Value

JVector

Softness

Gets or sets the softness (compliance) of the constraint.

public float Softness { get; set; }

Property Value

float

Default is 0. Higher values allow more positional error but improve stability. Scaled by inverse timestep during solving.

Methods

Create()

Sets the Iterate and PrepareForIteration function pointer fields on this instance. Override this in derived classes to assign the correct solver methods. The pointers are later written into ConstraintData when the constraint is enabled.

protected override void Create()

DebugDraw(IDebugDrawer)

Draws a debug visualization of this constraint.

public override void DebugDraw(IDebugDrawer drawer)

Parameters

drawer IDebugDrawer

The debug drawer to receive visualization primitives.

Exceptions

NotImplementedException

Thrown if the derived class does not override this method.

Initialize(JVector)

Initializes the constraint from a world-space anchor point.

public void Initialize(JVector anchor)

Parameters

anchor JVector

The anchor point in world space, shared by both bodies.

Remarks

Computes local anchor points for each body from their current poses. Default values: Bias = DefaultLinearBias, Softness = DefaultLinearSoftness.

IterateBallSocket(ref ConstraintData, float)

public static void IterateBallSocket(ref ConstraintData constraint, float idt)

Parameters

constraint ConstraintData
idt float

PrepareForIterationBallSocket(ref ConstraintData, float)

public static void PrepareForIterationBallSocket(ref ConstraintData constraint, float idt)

Parameters

constraint ConstraintData
idt float