Table of Contents

Class ConeLimit

Namespace
Jitter2.Dynamics.Constraints
Assembly
Jitter2.dll

Limits the relative tilt between two bodies, removing one angular degree of freedom when active.

public class ConeLimit : Constraint<ConeLimit.ConeLimitData>, IDebugDrawable
Inheritance
ConeLimit
Implements
Inherited Members

Properties

Angle

Gets the current angle between the two body axes.

public JAngle Angle { get; }

Property Value

JAngle

AxisBody1

Gets or sets the reference axis of body 1 in world space.

public JVector AxisBody1 { get; set; }

Property Value

JVector

AxisBody2

Gets or sets the reference axis of body 2 in world space.

public JVector AxisBody2 { get; set; }

Property Value

JVector

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 float Impulse { get; }

Property Value

float

Limit

Gets or sets the angular limit of the cone.

public AngularLimit Limit { get; set; }

Property Value

AngularLimit

Softness

Gets or sets the softness (compliance) of the 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 cone limit using a world-space axis and an angular range.

public void Initialize(JVector axis, AngularLimit limit)

Parameters

axis JVector

The reference axis in world space for the initial pose.

limit AngularLimit

The minimum and maximum allowed tilt angles.

Remarks

Stores the axis as a local axis on each body. The constraint measures the angle between these axes and restricts it to the given range. Default values: Softness = DefaultAngularSoftness, Bias = DefaultAngularBias.

Initialize(JVector, JVector, AngularLimit)

Initializes the cone limit using two world-space axes and an angular range.

public void Initialize(JVector axisBody1, JVector axisBody2, AngularLimit limit)

Parameters

axisBody1 JVector

The reference axis for body 1 in world space.

axisBody2 JVector

The reference axis for body 2 in world space.

limit AngularLimit

The minimum and maximum allowed tilt angles.

Remarks

Each axis is stored as a local axis on the corresponding body. The constraint measures the angle between these axes and restricts it to the given range. Default values: Softness = DefaultAngularSoftness, Bias = DefaultAngularBias.

IterateConeLimit(ref ConstraintData, float)

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

Parameters

constraint ConstraintData
idt float

PrepareForIterationConeLimit(ref ConstraintData, float)

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

Parameters

constraint ConstraintData
idt float