Skip to main content

ControllerInput

A class in Root.Township, the global namespace.

A snapshot of one hand controller's input: buttons, sticks, finger curl and hand velocity. SetAndCallEvents copies a new snapshot in and fires the button events that changed.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private readonly InputSource[] booleanInputsAll the button inputs in a fixed order, so SetAndCallEvents can copy and fire them in loops.
private readonly int inputLengthNumber of entries in booleanInputs.

Properties​

MemberWhat it is
Vector3 AngularVelocity { get; private set; }Hand angular velocity in world space.
Vector2 Gestures { get; set; }Stick value used for gesture input.
BooleanInput Grab { get; }Grab button.
BooleanInput GrabAssist { get; }Grab assist button.
float GrabAxis { get; set; }Analogue grab value.
float GrabStrength { get; set; }How hard the player is gripping.
BooleanInput HardGrab { get; }Hard grab button.
bool HasSkeleton { get; set; }True if the controller reports finger tracking.
bool HasSwipe { get; set; }True if the controller has a swipe surface.
BooleanInput LockForGestures { get; }Button that locks the hand for gestures.
BooleanInput LongPhoto { get; private set; }Long press of the photo button.
BooleanInput MetaMenu { get; }Meta menu (wrist menu) button, held.
BooleanInput ReleaseToggleGrab { get; }Button that releases a toggled grab.
float SecondaryAxis { get; set; }Secondary analogue value.
BooleanInput SendItemLeft { get; }Button that sends a held item to the left.
BooleanInput SendItemRight { get; }Button that sends a held item to the right.
float[] Skeleton { get; }Curl of the five fingers.
Vector2 SmoothLocomotion { get; set; }Stick value for smooth movement.
float SmoothRotationSpeed { get; set; }Speed for smooth turning.
BooleanInput SnapTurnLeft { get; }Snap turn left button.
BooleanInput SnapTurnRight { get; }Snap turn right button.
Vector2 SwipeMotion { get; set; }Swipe movement on the swipe surface.
BooleanInput SwipeTouch { get; }Touch on the swipe surface.
BooleanInput TakePhoto { get; }Photo button.
BooleanInput Teleport { get; }Teleport button.
BooleanInput ToggleGrab { get; }Toggle grab button.
BooleanInput ToggleMetaMenu { get; }Button that toggles the meta menu.
BooleanInput ToggleRun { get; }Run toggle button.
Vector3 Velocity { get; private set; }Hand velocity in world space.

Methods​

MemberWhat it is
void CalculateAndSetVelocities(IPlatformPlayer player, Vector3 velocity, Vector3 angularVelocity)Sets the hand velocities, rotated from the player's local space into world space.
BooleanInput GetButton(GeneralInputType button)Returns the button for a GeneralInputType, or null.
void SetAndCallEvents(PlayerInput controller, ControllerInput input)Copies all values from another snapshot, then fires events for buttons that changed.

Used in​

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