Connect to signals of device actions¶
This example shows how to connect a function to a signal that is triggered, when a device action is triggered.
vr/connectToDeviceActionSignal.py¶
1# © 2024 Autodesk, Inc. All rights reserved.
2
3# Simple function that should be called when an action is executed
4def pointerPrepare(action, device):
5 print("Pointer prepare")
6
7# Get the interaction that holds the action, the function should be connected to
8pointer = vrDeviceService.getInteraction("Pointer")
9# Get the interaction's action
10prepare = pointer.getControllerAction("prepare")
11# Connect the function to the actual signal of the action's signal object
12prepare.signal().triggered.connect(pointerPrepare)