RotatePickup
A class in Root.Township, the global namespace.
Rotates an object around one axis as players drag its pickups, like turning a wheel. The turn speed is capped per hand and in total, and an optional WheelGrab stops it at either end. The speed caps are saved.
- Listed in Global namespace: Q to R
- Inherits or implements
NetworkEntityBehaviour,ISavable<RotatePickupSaveData>,ISavableSave<RotatePickupSaveData>,ISavableSaveBase - Derived types
RotatePickupSaveData - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
RotatePickup() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private float maxRotatePerSecondPerHand | Degrees per second one hand can contribute. |
private float maxRotatePerSecondTotal | Degrees per second all hands together can turn it. |
private Pickup[] pickups | The pickups players grab to turn the object. |
private Dictionary<Interactor, Vector3> relativeGrabs | Each holding hand's grab point in the rotating object's local space. |
private Transform rotatingObject | The transform that turns; defaults to this one. |
private Vector3 rotationAxis | Local axis to turn around; defaults to up. |
private WheelGrab wheelGrab | Optional wheel whose Progress limits turning at 0 and 1. |
Methods
4 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Defaults the rotating object to this transform and the axis to up, and hooks the pickups' interaction events. |
private void Ended(Interactable interactable, Interactor interactor) | Forgets the releasing hand and disables updates once no hand is holding. |
private void Started(Interactable interactable, Interactor interactor) | Remembers where the hand grabbed in the object's local space and enables updates. |
private void Update() | Turns the object by the summed signed angle each hand has moved, clamped by the per-hand and total caps and by the wheel's progress limits. |