Class PointOnLine
- Namespace
- Jitter2.Dynamics.Constraints
- Assembly
- Jitter2.dll
Constrains a fixed point in the reference frame of one body to a line that is fixed in the reference frame of another body. This constraint removes two degrees of translational freedom; three if the limit is enforced.
public class PointOnLine : Constraint<PointOnLine.PointOnLineData>, IDebugDrawable
- Inheritance
-
PointOnLine
- Implements
- Inherited Members
Properties
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.01. Range [0, 1]. Higher values correct errors faster but may cause instability.
Distance
Gets the current distance of the anchor point from the line origin along the axis.
public float Distance { get; }
Property Value
Impulse
Gets the accumulated impulse applied by this constraint during the last step.
public JVector Impulse { get; }
Property Value
LimitBias
Gets or sets the bias factor for distance limit correction.
public float LimitBias { get; set; }
Property Value
- float
Default is 0.2. Range [0, 1]. Higher values correct limit violations faster.
LimitSoftness
Gets or sets the softness (compliance) applied when distance limits are active.
public float LimitSoftness { get; set; }
Property Value
- float
Default is 0.0001. Higher values allow more limit violation but improve stability.
Softness
Gets or sets the softness (compliance) of the constraint.
public float Softness { get; set; }
Property Value
- float
Default is 0.00001. Higher values allow more positional 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, JVector)
Initializes the constraint from world-space parameters.
public void Initialize(JVector axis, JVector anchor1, JVector anchor2)
Parameters
axisJVectorThe line axis in world space, fixed in the reference frame of body 1.
anchor1JVectorAnchor point on body 1 defining the line origin in world space.
anchor2JVectorAnchor point on body 2 constrained to the line in world space.
Remarks
Computes local anchor points and axis from the current body poses. Default values: Bias = DefaultLinearBias, Softness = DefaultLinearSoftness, LimitSoftness = DefaultLinearLimitSoftness, LimitBias = DefaultLinearLimitBias.
Initialize(JVector, JVector, JVector, LinearLimit)
Initializes the constraint from world-space parameters.
public void Initialize(JVector axis, JVector anchor1, JVector anchor2, LinearLimit limit)
Parameters
axisJVectorThe line axis in world space, fixed in the reference frame of body 1.
anchor1JVectorAnchor point on body 1 defining the line origin in world space.
anchor2JVectorAnchor point on body 2 constrained to the line in world space.
limitLinearLimitDistance limit along the axis.
Remarks
Computes local anchor points and axis from the current body poses. Default values: Bias = DefaultLinearBias, Softness = DefaultLinearSoftness, LimitSoftness = DefaultLinearLimitSoftness, LimitBias = DefaultLinearLimitBias.
IteratePointOnLine(ref ConstraintData, float)
public static void IteratePointOnLine(ref ConstraintData constraint, float idt)
Parameters
constraintConstraintDataidtfloat
PrepareForIterationPointOnLine(ref ConstraintData, float)
public static void PrepareForIterationPointOnLine(ref ConstraintData constraint, float idt)
Parameters
constraintConstraintDataidtfloat