Skip to main content

PickupJoints

A class in Root.Township, the global namespace.

Creates and removes the physics joints that tie a Pickup to each hand holding it. The joint kind comes from the pickup's joint type.

Constructors​

MemberWhat it is
PickupJoints(Pickup pickup, bool isEnvironmentalJoint, PickUpJointType jointType)Creates a PickupJoints from pickup, isEnvironmentalJoint and jointType.

Fields​

4 private and internal fields
MemberWhat it is
private IUnityUpdateMethod fixedJointUpdateHandle for the late update used by regular-update fixed joints.
private bool isEnvironmentalJointWhether the pickup is part of the environment; changes velocity joint drives.
private PickUpJointType jointTypeWhich kind of joint to create.
private Pickup pickupThe pickup these joints hold.

Properties​

MemberWhat it is
Dictionary<Interactor, Component> Joints { get; }Joint component per holding interactor.

Methods​

MemberWhat it is
void CreateJoint(Interactor interactor)Adds the joint for this pickup's joint type to the hand and records the grab offset on the hand. Does nothing if one exists.
void DestroyJoint(Interactor interactor)Removes the hand's joint and unparents the pickup if it was the last hand and it isn't docked.
void HandleFinishInteraction(Interactor interactor)On release, gives the pickup the hand's velocity plus walking speed, compressed like the network. Skipped for spring joints and crafted children.
bool IsValidFinishInteraction(Interactor interactor)Whether the hand still has a live joint; drops destroyed ones.
3 private and internal methods
MemberWhat it is
private Component CreateEmptyJoint(Interactor interactor)Adds an EmptyJoint to the hand's interaction point.
private Component CreateVelocityJoint(Interactor interactor, Quaternion lastGrabRotation, out Joint unityJoint)Parents the pickup to the hand and adds a VelocityJoint set up from velocity pickup settings. The server uses fixed multipliers.
private void FixedJointUpdate()Late update for regular-update fixed joints: snaps the pickup to the grip point.

Used in​

Members of other types that take, return or hold a PickupJoints: