Utility Scripts · Sockets

Connection Types

One matching and attraction path can create four different physical constraints.

connection_type and its parameters belong to the male Socket. The female supplies the target anchor and world frame. Attraction stops after constraint creation.

Overview#

connection_typeConstraintAllowed motion
fixedjolt_fixedNo relative translation or rotation.
hingejolt_hingeRotation around one axis, optionally limited.
pointjolt_pointA shared anchor with free relative rotation.
swing_twistjolt_swing_twistA shared point with a limited swing cone and twist range.

Fixed#

GML
jolt_socket(part, "male", "mount", {
    connection_type: "fixed",
    collision: false
});

The default recipe creates a body-to-body Fixed constraint at the precisely aligned relative transform. Use it for panels, tools in holders, lids, and rigid modules.

Hinge#

GML
jolt_socket(wheel, "male", "axle", {
    connection_type: "hinge",
    hinge_axis: { x:0, y:0, z:1 },
    hinge_limits_min: -180,
    hinge_limits_max: 180,
    attraction: true,
    collision: false
});
  • hinge_axis is normalized in the female Socket frame; default {0,0,1}.
  • hinge_limits_min is -180..0 (default -180) and hinge_limits_max is 0..180 (default 180).
  • The current female world position is the anchor. Rotated parents and local Socket rotation transform the axis correctly.

Point#

GML
jolt_socket(ball, "male", "rope_end", {
    connection_type: "point",
    attraction: true,
    collision: false
});

Both bodies share the female Socket world position as an anchor while all relative rotation remains free. Point supports max_force but rejects max_torque because it constrains no angular degree of freedom.

SwingTwist#

GML
jolt_socket(arm, "male", "shoulder", {
    connection_type: "swing_twist",
    twist_axis: { x:0, y:0, z:1 },
    plane_axis: { x:1, y:0, z:0 },
    normal_half_angle: 25,
    plane_half_angle: 45,
    twist_min: -20,
    twist_max: 30,
    attraction: true,
    collision: false
});
  • twist_axis and plane_axis are nonparallel axes in the female Socket frame; defaults are +Z and +X.
  • normal_half_angle and plane_half_angle (0..180) define an elliptical swing cone. swing_angle defaults both to 45.
  • twist_min and twist_max define an ordered signed range within -180..180; defaults are -30..30.
  • The current Socket recipe has no motor, spring, or friction setting.