Skip to main content

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.

Constructors​

MemberWhat it is
GrabPoint()Creates a GrabPoint with default values.

Fields​

MemberWhat it is
RotationMode rotationModeBacking field for RotationMode.
16 private and internal fields
MemberWhat it is
private PickupFromDockRestriction dockedRestrictionHand 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> enabledFromDocksBacking field for EnabledFromDocks.
private Interactor interactorNot used by this class.
private bool isDisabledBacking field for IsDisabled. Shown under Debug in the inspector.
private bool isIgnoringAngleWhen true, CheckScore scores only on distance and ignores the hand angle.
private bool isSetupWithLeftFor FixedFlip mode, which hand the fixed rotation was authored for; the other hand gets it flipped 180 degrees.
private bool isUsingLocalWith a transform set, read its local position and rotation directly instead of converting from world space.
private Vector3 linearLocal axis the grip can slide along; the hand's position is projected onto it.
private PickupFromDockRestriction nonDockedRestrictionBacking field for NonDockedRestriction: the hand and rotation limits used when the pickup isn't docked.
private float offsetSideways shift of the hand along its right axis, mirrored for the left hand, before scoring.
private Vector3 poleForwardPole direction for the pole modes. In Surface mode it holds the surface half extents instead.
private Vector3 positionLocal grip position used when no transform is set.
private bool refuseMultipleHandsWhen true, ApplyTo marks the point occupied so a second hand can't use it.
private Vector3 rotationEulerLocal grip rotation in Euler angles, used when no transform is set.
private ThumbPosition thumbPositionThumb pose given to the holder's grip animator when the point is applied.
private Transform transformBacking field for Transform. When set, the grip position and rotation come from it.

Properties​

MemberWhat 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​

MemberWhat 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: