Contents

PhysicsCustomJoint

A joint with six degrees of freedom that can be individually specified.

Declaration

struct PhysicsCustomJoint

Overview

A custom joint allows you to choose the restraints of all 6 degrees of freedom. You can set a PhysicsCustomJoint.MotionLimit for each degrees’ motion.

For example, you can constrain the motion of pin1 in the xy-plane of pin0, set movement along the x-axis to PhysicsCustomJoint.MotionLimit.unlimited, and leave all rotations as the default value of PhysicsCustomJoint.MotionLimit.fixed.

let joint = PhysicsCustomJoint(
    pin0: entity0pin,
    pin1: entity1pin,
    linearMotionAlongX: .unlimited,
    linearMotionAlongY: .range(-5...5)
)

If pin0 is in a fixed location for the example above, this joint allows pin1 to move anywhere along the x-axis of pin0, and can move up to 5 local meters above or below the y-axis of pin0.

Topics

Initializers

Instance Properties

Enumerations

See Also

Built-in joint types