public record struct ConstraintDescriptionEverything needed to create a constraint, in one value.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
One description for six joints rather than six types, because they overwhelmingly share parameters — two bodies, two anchor points, an axis, a pair of limits, a spring and a motor — and the alternative is six near-identical records plus the dispatch to tell them apart. What each field means for each kind is on the field.
Anchors are in world space. Jolt will take either, and world space is the one an author can reason about: the hinge is where the hinge visibly is, and Jolt converts to body-local at creation using the poses the bodies have at that moment. The consequence is that a constraint must be created after both bodies are where they belong.
Fields and properties (13)
public ConstraintKind KindWhich joint.
public BodyHandle FirstOne of the two bodies.
public BodyHandle SecondThe other. May be None to pin to the world.
public Vector3 FirstAnchorWhere the joint is on the first body, in world space.
public Vector3 SecondAnchorWhere the joint is on the second body, in world space.
public Vector3 AxisThe axis the joint turns about (hinge, cone) or slides along (slider), in world space.
public float LimitMinimumThe lower limit: an angle in radians for a hinge, a distance in metres for a slider or a distance joint. Ignored by the kinds that have no limits.
public float LimitMaximumThe upper limit, in the same units as LimitMinimum.
public float HalfConeAngleThe half-angle of a cone constraint, in radians.
public ConstraintSpring SpringHow the limits are sprung.
public ConstraintMotor MotorWhether the motor is driving, and towards what kind of target.
public float MotorTargetWhat the motor is driving towards: a velocity in metres or radians a second, or a position in metres or radians, depending on Motor.
public float MotorMaximumThe most force or torque the motor may use. Zero means unlimited.
Methods (6)
public static ConstraintDescription Fixed(BodyHandle first, BodyHandle second, Vector3 anchor)Welds two bodies together where they stand.
public static ConstraintDescription Point(BodyHandle first, BodyHandle second, Vector3 anchor)A ball joint.
public static ConstraintDescription Hinge(BodyHandle first, BodyHandle second, Vector3 anchor, Vector3 axis)A hinge, free to turn all the way round.
public static ConstraintDescription Slider(BodyHandle first, BodyHandle second, Vector3 anchor, Vector3 axis)A slider, free along its whole axis.
public static ConstraintDescription Distance(BodyHandle first, BodyHandle second, Vector3 firstAnchor, Vector3 secondAnchor, float minimum, float maximum)A rope: two points held no further apart than a maximum.
public static ConstraintDescription Cone(BodyHandle first, BodyHandle second, Vector3 anchor, Vector3 twistAxis, float halfConeAngle)A cone: the second body's twist axis held within a half-angle of the first's.
Used by (4)
- PhysicsConstraintTestsVixen.Physics.Tests
- PhysicsSceneTestsVixen.Physics.Tests
- PhysicsWorldVixen.Physics
- Vixen_Physics_Constraints_ConstraintDescriptionSerializerVixen.Physics