Controls Gesture
scripts/vscripts/alyxlib/controls/gesture.lua
Properties
version
Default value
"v1.2.1"
AutoStart
Default value
false
DebugEnabled
Default value
false
Duration
Default value
0.3
Gestures
Default value
table
CurrentGesture
Default value
table
PreviousGesture
Default value
table
DicrepancyTolerance
Methods
AddGesture
Adds a new gesture to watch for.
If a finger position is nil, that finger isn't considered.
Parameters
name
string
Gesture name; overwrites existing one if not uniqueindex
number,nil
[0–1] range of the index finger position.middle
number,nil
[0–1] range of the middle finger position.ring
number,nil
[0–1] range of the ring finger position.pinky
number,nil
[0–1] range of the pinky finger position.thumb
number,nil
[0–1] range of the thumb finger position.
RemoveGesture
Removes an existing gesture.
Any callbacks registered with the gesture will be unregistered.
Parameters
name
string
Gesture name
RemoveGestures
Removes a list of gestures.
Parameters
names
GestureNames[]
List of gesture names
GetGesture
Gets the current gesture name of a given hand.
E.g.
Example
Parameters
hand
CPropVRHand,0,1
The hand to get the gesture of
Returns
- GestureNames
Gesture name
GetGestureRaw
Gets the current [0–1] finger curl values of a given hand.
Parameters
hand
CPropVRHand,0,1
The hand to get the gesture of
Returns
- GestureTable
Gesture values
RegisterCallback
Registers a callback for a specific gesture start/stop.
Parameters
kind
"start","stop"
Listen for the start or stop of the gesturehand
CPropVRHand,-1,0,1
The hand to listen togesture
GestureNames
The gesture to listen forduration
Not implementedcallback
function
The function to call when the gesture is triggeredcontext(optional)
any
Context to pass to the callback
UnregisterCallback
Unregisters a callback function.
Parameters
callback
function
The function to unregister
Start
Starts the gesture system.
Parameters
on
EntityHandle?
Optional entity to do the tracking on
Stop
Stops the gesture system.
Types
GestureTable
Gesture table.
| Field | Type | Description |
|---|---|---|
| name | GestureNames |
Gesture name |
| index | number|nil |
[0–1] range of the index finger position |
| middle | number|nil |
[0–1] range of the middle finger position |
| ring | number|nil |
[0–1] range of the ring finger position |
| pinky | number|nil |
[0–1] range of the pinky finger position |
| thumb | number|nil |
[0–1] range of the thumb finger position |
GESTURE_CALLBACK
| Field | Type | Description |
|---|---|---|
| kind | "start"|"stop" |
If the gesture was started or stopped |
| name | GestureNames |
The name of the gesture performed |
| hand | CPropVRHand |
The hand the gesture was performed on |
| time | number |
Server time the gesture occurred |
Aliases
GestureNames
| Value | Description |
|---|---|
string |
|
"OpenHand" |
|
"ClosedFist" |
|
"ThumbsUp" |
|
"DevilHorns" |
|
"Point" |
|
"FingerGun" |
|
"PinkyOut" |
|
"Shaka" |
|
"MiddleFinger" |
|
"TheShocker" |
|
"Peace" |