Class Constraint
- Namespace
- Jitter2.Dynamics.Constraints
- Assembly
- Jitter2.dll
Base class for constraints that connect two rigid bodies and restrict their relative motion.
public abstract class Constraint : IDebugDrawable
- Inheritance
-
Constraint
- Implements
- Derived
- Inherited Members
Fields
DefaultAngularBias
Default bias factor for angular error correction.
public const float DefaultAngularBias = 0.2
Field Value
DefaultAngularLimitBias
Default bias factor for angular limit correction.
public const float DefaultAngularLimitBias = 0.1
Field Value
DefaultAngularLimitSoftness
Default softness for angular limit enforcement.
public const float DefaultAngularLimitSoftness = 0.001
Field Value
DefaultAngularSoftness
Default softness (compliance) for angular constraints.
public const float DefaultAngularSoftness = 0.001
Field Value
DefaultLinearBias
Default bias factor for linear error correction.
public const float DefaultLinearBias = 0.2
Field Value
DefaultLinearLimitBias
Default bias factor for linear limit correction.
public const float DefaultLinearLimitBias = 0.2
Field Value
DefaultLinearLimitSoftness
Default softness for linear limit enforcement.
public const float DefaultLinearLimitSoftness = 0.0001
Field Value
DefaultLinearSoftness
Default softness (compliance) for linear constraints.
public const float DefaultLinearSoftness = 1E-05
Field Value
Iterate
protected delegate*<ref ConstraintData, float, void> Iterate
Field Value
- delegate*<ref ConstraintData, float, void>
PrepareForIteration
protected delegate*<ref ConstraintData, float, void> PrepareForIteration
Field Value
- delegate*<ref ConstraintData, float, void>
Properties
Body1
Gets the first rigid body connected by this constraint.
public RigidBody Body1 { get; }
Property Value
Body2
Gets the second rigid body connected by this constraint.
public RigidBody Body2 { get; }
Property Value
Handle
A handle for accessing the raw constraint data.
public JHandle<ConstraintData> Handle { get; }
Property Value
IsEnabled
Gets or sets whether this constraint is enabled.
public bool IsEnabled { get; set; }
Property Value
Remarks
Use Remove(Constraint) for permanent removal.
IsSmallConstraint
Gets whether this constraint uses the smaller data layout.
public virtual bool IsSmallConstraint { get; }
Property Value
SmallHandle
Gets a handle to the constraint data reinterpreted as SmallConstraintData.
public JHandle<SmallConstraintData> SmallHandle { get; }
Property Value
Methods
CheckDataSize<T>()
Checks that the constraint data type fits within ConstraintData.
protected static void CheckDataSize<T>() where T : unmanaged
Type Parameters
TThe constraint-specific data type.
Exceptions
- InvalidOperationException
Thrown if the data type is too large.
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 virtual void Create()
DebugDraw(IDebugDrawer)
Draws a debug visualization of this constraint.
public virtual void DebugDraw(IDebugDrawer drawer)
Parameters
drawerIDebugDrawerThe debug drawer to receive visualization primitives.
Exceptions
- NotImplementedException
Thrown if the derived class does not override this method.
VerifyNotZero()
Verifies that this constraint has been properly created via the World class.
protected void VerifyNotZero()
Exceptions
- InvalidOperationException
Thrown if the constraint was instantiated directly instead of through CreateConstraint<T>(RigidBody, RigidBody).