GrabPoint
A class in Root.Township, the global namespace.
A spot on a pickup where a hand can hold it, with a rule for how the hand may turn. A plain serialized class; a Pickup has an array of them and grabs the lowest scoring one.
- Listed in Global namespace: E to H
- Documented in Grab points and hand-touch points
Constructors
| Member | What it is |
|---|---|
GrabPoint() | Creates a GrabPoint with default values. |
Fields
| Member | What it is |
|---|---|
RotationMode rotationMode | Backing field for RotationMode. |
16 private and internal fields
| Member | What it is |
|---|---|
private PickupFromDockRestriction dockedRestriction | Hand and rotation limits used when grabbing the pickup out of a dock: can block the left or right hand, or force fixed rotation. |
private List<PickupDockSettings> enabledFromDocks | Backing field for EnabledFromDocks. |
private Interactor interactor | Not used by this class. |
private bool isDisabled | Backing field for IsDisabled. Shown under Debug in the inspector. |
private bool isIgnoringAngle | When true, CheckScore scores only on distance and ignores the hand angle. |
private bool isSetupWithLeft | For FixedFlip mode, which hand the fixed rotation was authored for; the other hand gets it flipped 180 degrees. |
private bool isUsingLocal | With a transform set, read its local position and rotation directly instead of converting from world space. |
private Vector3 linear | Local axis the grip can slide along; the hand's position is projected onto it. |
private PickupFromDockRestriction nonDockedRestriction | Backing field for NonDockedRestriction: the hand and rotation limits used when the pickup isn't docked. |
private float offset | Sideways shift of the hand along its right axis, mirrored for the left hand, before scoring. |
private Vector3 poleForward | Pole direction for the pole modes. In Surface mode it holds the surface half extents instead. |
private Vector3 position | Local grip position used when no transform is set. |
private bool refuseMultipleHands | When true, ApplyTo marks the point occupied so a second hand can't use it. |
private Vector3 rotationEuler | Local grip rotation in Euler angles, used when no transform is set. |
private ThumbPosition thumbPosition | Thumb pose given to the holder's grip animator when the point is applied. |
private Transform transform | Backing field for Transform. When set, the grip position and rotation come from it. |
Properties
| Member | What it is |
|---|---|
List<PickupDockSettings> EnabledFromDocks { get; } | If not empty, the point can only be used while docked when the dock is one of these kinds. Undocked, it is always usable. |
bool IsDisabled { get; set; } | Turns the point off. |
bool IsOcupied { get; set; } | Taken by a hand. Only set for points that refuse a second hand (misspelt in the code). |
float LastLinearPosition { get; set; } | Where along the linear extent (0 to 1) the hand ended up in the last CheckScore. |
Vector3 LastPosition { get; set; } | Fitted local position from the last CheckScore. |
Quaternion LastRotation { get; set; } | Fitted local rotation from the last CheckScore. |
PickupFromDockRestriction NonDockedRestriction { get; set; } | Flags for when the item is not docked: no left hand, no right hand, or force fixed rotation. |
RotationMode RotationMode { get; } | How the hand's rotation is fitted: free, fixed, fixed flip, pole, one-way pole or surface. |
Transform Transform { get; } | Transform marking the point, if used. Otherwise a stored local position and rotation are used. |
Methods
| Member | What it is |
|---|---|
void ApplyTo(float scale, Interactor holder, Transform target) | Moves the item so the hand sits on the pose from the last CheckScore. Marks single-hand points as taken. |
void ApplyTo(float scale, Transform interactionPoint, Transform target) | Moves the item so the hand sits on the pose from the last CheckScore. Marks single-hand points as taken. |
float CheckScore(Transform pickup, float scale, float distanceWeighting, float angleWeighting, Vector3 localHandPosition, Quaternion localHandRotation, bool isLeft, bool isDocked) | Scores a hand against this point (distance plus angle) and stores the fitted pose. Infinity means not allowed for this hand. |
void DrawGizmos(float scale) | Editor: draws the point, its axes, linear extent and pole or surface limits. |
Used in
Members of other types that take, return or hold a GrabPoint: