SteamVR/Environments/Scripting/API/CBasePlayer.IsVRControllerButtonPressed
< SteamVR | Environments | Scripting | API
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 |