‹›
Utility Scripts · Sockets

Collision, Disconnect, and Cooldown

A connection can suppress collision only for its own body pair and safely restores it whenever the connection ends.

collision belongs to the male recipe and defaults to true for backward compatibility. It does not alter collision layers or either body's behavior against the world.

Pair collision#

SettingResult
collision: trueThe connected bodies continue colliding with each other.
collision: falseOnly this body pair ignores collision while the connection exists.

Hinge, Point, and SwingTwist often need collision:false when colliders overlap around the anchor. Otherwise the contact solver may block motion that the constraint allows.

Safe disconnect#

GML
male_socket.disconnect();

// Equivalent through a retained owner:
var old_connection = male_socket.connection;
old_connection.destroy();
  • destroy() removes the real constraint and its wrapper restores pair collision.
  • Both endpoints become free; candidate and connection are cleared.
  • Both Sockets receive the longer endpoint cooldown, preventing an immediate reconnect.
  • After cooldown, the same pair can pass matching normally.
GML
// Disabling discovery does not disconnect an existing joint.
socket.set_enabled(false);

if (is_struct(socket.connection)) socket.disconnect();

Verified operation contracts#

These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.

Symbol / ownerSignatureOperation contract
JoltSocketConnection.destroyJoltSocketConnection.destroy()Boolean idempotently destroys constraint, clears connections and applies the longest member cooldown to all sockets. Does not destroy bodies.