Vixen
02b45cc4
csharp
public record struct ConstraintDescription

Everything 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 Kind

    Which joint.

  • public BodyHandle First

    One of the two bodies.

  • public BodyHandle Second

    The other. May be None to pin to the world.

  • public Vector3 FirstAnchor

    Where the joint is on the first body, in world space.

  • public Vector3 SecondAnchor

    Where the joint is on the second body, in world space.

  • public Vector3 Axis

    The axis the joint turns about (hinge, cone) or slides along (slider), in world space.

  • public float LimitMinimum

    The 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 LimitMaximum

    The upper limit, in the same units as LimitMinimum.

  • public float HalfConeAngle

    The half-angle of a cone constraint, in radians.

  • public ConstraintSpring Spring

    How the limits are sprung.

  • public ConstraintMotor Motor

    Whether the motor is driving, and towards what kind of target.

  • public float MotorTarget

    What 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 MotorMaximum

    The most force or torque the motor may use. Zero means unlimited.

Methods (6)

Used by (4)

  • PhysicsConstraintTestsVixen.Physics.Tests
  • PhysicsSceneTestsVixen.Physics.Tests
  • PhysicsWorldVixen.Physics
  • Vixen_Physics_Constraints_ConstraintDescriptionSerializerVixen.Physics