Class TwistAngle
- Namespace
- Jitter2.Dynamics.Constraints
- Assembly
- Jitter2.dll
Constrains the relative twist of two bodies. This constraint removes one angular degree of freedom when the limit is enforced.
public class TwistAngle : Constraint<TwistAngle.TwistLimitData>, IDebugDrawable
- Inheritance
-
TwistAngle
- Implements
- Inherited Members
Properties
Angle
Gets the current twist angle relative to the initial pose.
public JAngle Angle { get; }
Property Value
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
Limit
Sets the angular limits for the twist rotation.
public AngularLimit Limit { set; }
Property Value
Softness
Gets or sets the softness (compliance) of the constraint.
public float Softness { get; set; }
Property Value
- float
Default is 0.0001. 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
drawerIDebugDrawerThe debug drawer to receive visualization primitives.
Exceptions
- NotImplementedException
Thrown if the derived class does not override this method.
Initialize(JVector, JVector)
Initializes the constraint with a fixed twist angle (no rotation allowed).
public void Initialize(JVector axis1, JVector axis2)
Parameters
axis1JVectorThe twist axis for body 1 in world space.
axis2JVectorThe twist axis for body 2 in world space.
Initialize(JVector, JVector, AngularLimit)
Initializes the constraint from world-space axes and angular limits.
public void Initialize(JVector axis1, JVector axis2, AngularLimit limit)
Parameters
axis1JVectorThe twist axis for body 1 in world space.
axis2JVectorThe twist axis for body 2 in world space.
limitAngularLimitThe allowed relative twist angle range.
Remarks
Stores each axis in the local frame of its body and records the initial relative orientation. Default values: Softness = DefaultAngularSoftness, Bias = DefaultAngularBias.
IterateTwistAngle(ref ConstraintData, float)
public static void IterateTwistAngle(ref ConstraintData constraint, float idt)
Parameters
constraintConstraintDataidtfloat
PrepareForIterationTwistAngle(ref ConstraintData, float)
public static void PrepareForIterationTwistAngle(ref ConstraintData constraint, float idt)
Parameters
constraintConstraintDataidtfloat