MultiHandPickup
A class in Root.Township, the global namespace.
A pickup that needs several hands (2 or more) to lift, such as a heavy log. With fewer hands, each grab stays loose and lets go if the hand pulls too far away.
- Listed in Global namespace: M to O
- Inherits or implements
Pickup - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
MultiHandPickup() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private Dictionary<Interactor, Coroutine> distanceCheckCoroutine | Running CheckDistance coroutine per hand. |
private bool isCreatingJoints | True while CreateJoint is joining all hands, so the inner calls take the normal path. |
private float maxDistanceToReleaseSquared | Squared distance between real and ghost hand that makes a loose grab let go. |
private int minHandsToPickup | Hands needed to lift it (at least 2). |
private MethodSync syncVelocity | Method sync for the speed at release. |
Properties
| Member | What it is |
|---|---|
override int InteractorsToRelease { get; } | Returns minHandsToPickup. |
Methods
| Member | What it is |
|---|---|
override void FinishInteraction(Interactor oldInteractor) | When a release leaves one hand too few, drops and regrabs the remaining hands so they go back to the loose state. |
override void Initialize() | Creates the velocity sync. |
override void Interact(Interactor interactor) | Keeps the body kinematic while fewer than minHandsToPickup hands hold it. |
override void NetworkStopInteraction(InteractArguments arguments, Interactor interactor, Action<Interactable> handleInteractionEnd) | Ends the interaction and, if enough hands were holding, applies the networked position, rotation and speed. |
protected override void AddSecondaryCollision() | Adds the secondary collision check only once enough hands hold it and the last holder is the local player. |
protected override void CreateJoint(Interactor newInteractor) | Holds off on real joints until minHandsToPickup hands grab, then joins all of them at once. Extra hands join normally. |
2 private and internal methods
| Member | What it is |
|---|---|
private IEnumerator CheckDistance(Interactor interactor) (iterator) | Local coroutine for a hand that can't lift it yet: lets go once the real hand is too far from the ghost hand. |
private void SyncVelocity(IPlayer player, Stream stream) | Sends the body's speed and spin. The server forwards it to other players. |