Table of Contents

Class HingeAngle

Namespace
Jitter2.Dynamics.Constraints
Assembly
Jitter2.dll

Constrains two bodies to rotate relative to each other around a single axis, removing two angular degrees of freedom. Optionally enforces angular limits.

public class HingeAngle : Constraint<HingeAngle.HingeAngleData>, IDebugDrawable
Inheritance
HingeAngle
Implements
Inherited Members

Properties

Angle

Gets the current angle of rotation around the hinge axis relative to the initial pose.

public JAngle Angle { get; }

Property Value

JAngle

Bias

Gets or sets the bias factor controlling how aggressively angular 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

Limit

Sets the angular limits for the hinge rotation.

public AngularLimit Limit { set; }

Property Value

AngularLimit

LimitBias

Gets or sets the bias factor for angular limit correction.

public float LimitBias { get; set; }

Property Value

float

Default is 0.1. Range [0, 1]. Higher values correct limit violations faster.

LimitSoftness

Gets or sets the softness (compliance) applied when angular limits are active.

public float LimitSoftness { get; set; }

Property Value

float

Default is 0.001. Higher values allow more limit violation but improve stability.

Softness

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

public float Softness { get; set; }

Property Value

float

Default is 0.001. Higher values allow more angular error but improve stability.

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, AngularLimit)

Initializes the constraint with a rotation axis and angular limits.

public void Initialize(JVector axis, AngularLimit limit)

Parameters

axis JVector

The hinge axis in world space around which rotation is allowed.

limit AngularLimit

The angular limits defining the allowed rotation range.

Remarks

Stores the axis in the local frame of body 2 and records the initial relative orientation. Default values: Softness = DefaultAngularSoftness, LimitSoftness = DefaultAngularLimitSoftness, Bias = DefaultAngularBias, LimitBias = DefaultAngularLimitBias.

IterateHingeAngle(ref ConstraintData, float)

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

Parameters

constraint ConstraintData
idt float

PrepareForIterationHingeAngle(ref ConstraintData, float)

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

Parameters

constraint ConstraintData
idt float