Class PointOnPlane
- Namespace
- Jitter2.Dynamics.Constraints
- Assembly
- Jitter2.dll
Constrains a fixed point in the reference frame of one body to a plane that is fixed in the reference frame of another body. This constraint removes one degree of translational freedom if the limit is enforced.
public class PointOnPlane : Constraint<PointOnPlane.SliderData>, IDebugDrawable
- Inheritance
-
PointOnPlane
- 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. 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
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 solver dispatch id used by this instance. Override this in derived classes to assign the correct registered solver pair. The id is later written into the unmanaged header 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 plane normal in world space, fixed in the reference frame of body 1.
anchor1JVectorAnchor point on body 1 defining the plane origin in world space.
anchor2JVectorAnchor point on body 2 constrained to the plane in world space.
Remarks
Computes local anchor points and axis from the current body poses. Default values: Bias = DefaultLinearBias, Softness = DefaultLinearSoftness.
Exceptions
- ArgumentException
Thrown when
axisis zero or contains a non-finite value, whenanchor1oranchor2contains a non-finite value, or when either value inlimitis NaN.
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 plane normal in world space, fixed in the reference frame of body 1.
anchor1JVectorAnchor point on body 1 defining the plane origin in world space.
anchor2JVectorAnchor point on body 2 constrained to the plane in world space.
limitLinearLimitDistance limit from the plane.
Remarks
Computes local anchor points and axis from the current body poses. Default values: Bias = DefaultLinearBias, Softness = DefaultLinearSoftness.
Exceptions
- ArgumentException
Thrown when
axisis zero or contains a non-finite value, whenanchor1oranchor2contains a non-finite value, or when either value inlimitis NaN.
IteratePointOnPlane(ref ConstraintData, float)
public static void IteratePointOnPlane(ref ConstraintData constraint, float idt)
Parameters
constraintConstraintDataidtfloat
PrepareForIterationPointOnPlane(ref ConstraintData, float)
public static void PrepareForIterationPointOnPlane(ref ConstraintData constraint, float idt)
Parameters
constraintConstraintDataidtfloat
ResetWarmStart()
Resets the cached warm-start state used by the solver for this constraint.
public override void ResetWarmStart()
Remarks
This clears only persistent solver impulses. Constraint configuration remains unchanged. Useful after restoring snapshots or other discontinuous state changes where preserving warm-starting is undesirable.