Skip to main content

DockableJoints

A class in Root.Township, the global namespace.

A pickup with jointed child rigidbodies that freezes them and snaps them back to their starting local poses while it is docked.

Constructors​

MemberWhat it is
DockableJoints()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private int bodiesCountNumber of entries in jointedBodies, cached in Awake.
private Rigidbody[] jointedBodiesThe child rigidbodies to freeze while docked.
private TransformSave[] savesLocal transform of each jointed body as recorded in Awake.

Methods​

MemberWhat it is
protected override void Awake()Hooks the dock and undock events and records each jointed body's local transform.
2 private and internal methods
MemberWhat it is
private void OnDocked(Interactor interactor, Pickup pickup, PickupDock dock)Makes every jointed body kinematic and restores its saved local transform.
private void OnUndocked(Interactor interactor, Pickup pickup, PickupDock dock)Makes the jointed bodies non-kinematic again so the joints move freely.