SteamVR/Environments/Scripting/API/CBasePlayer.IsVRControllerButtonPressed: Difference between revisions
< SteamVR | Environments | Scripting | API
Jump to navigation
Jump to search
(Created page with "== Function Description == ''' bool IsVRControllerButtonPressed(int ''nButton'') ''' Checks if the specified button on the motion controller is pressed. ;Example <source...") |
Thunder4ik (talk | contribs) m (clean up, added deadend tag) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Dead end|date=January 2024}} | |||
== Function Description == | == Function Description == | ||
Line 4: | Line 6: | ||
Checks if the specified button on the motion controller is pressed. | Checks if the specified button on the motion controller is pressed. | ||
;Example | ;Example | ||
Line 94: | Line 94: | ||
|} | |} | ||
[[Category: | [[Category:SteamVR]] | ||
[[Category:SteamVR Home]] | |||
[[Category:Scripting]] |
Latest revision as of 10:14, 21 January 2024

This article has no
links to other VDC articles. Please help improve this article by adding links
that are relevant to the context within the existing text.
January 2024


January 2024
Function Description
bool IsVRControllerButtonPressed(int nButton)
Checks if the specified button on the motion controller is pressed.
- Example
local player = Entities:FindByClassname(nil, "player")
if player:IsVRControllerButtonPressed(24)
then
print("Trigger 1 is pressed!")
else
print("Trigger 1 is not pressed!")
end
Parameters
Type | Name | Description |
---|---|---|
int | nButton | Button index to check. |
Returns
bool - Whether the button is pressed.
Button Indices
Enumeration | Value |
---|---|
IN_USE_HAND0 | 24 |
IN_USE_HAND1 | 25 |
IN_PAD_LEFT_HAND0 | 26 |
IN_PAD_RIGHT_HAND0 | 27 |
IN_PAD_UP_HAND0 | 28 |
IN_PAD_DOWN_HAND0 | 29 |
IN_PAD_LEFT_HAND1 | 30 |
IN_PAD_RIGHT_HAND1 | 31 |
IN_PAD_UP_HAND1 | 32 |
IN_PAD_DOWN_HAND1 | 33 |
IN_MENU_HAND0 | 34 |
IN_MENU_HAND1 | 35 |
IN_GRIP_HAND0 | 36 |
IN_GRIP_HAND1 | 37 |
IN_PAD_HAND0 | 38 |
IN_PAD_HAND1 | 39 |
IN_PAD_TOUCH_HAND0 | 40 |
IN_PAD_TOUCH_HAND1 | 41 |