The current version of Studio 6.5 does not expose access to the trigger input on the ZapBox controllers. However it is possible to still make use of the Studio “ZapBox Tracker” setup and enable input support. Here’s how:
- Add zapbox_trigger_controllers_withworld.zpt (28.8 KB) to the Media Library.
- Switch the “Source” property on the ZapBox Tracker node to use this file. You can also delete the “ZapBox User Map.zpt” that Studio uses by default.
- Add a script node as a child of the ZapBox Controller in the hierarchy. You can hook into the
seen
event emitted by this node to access the underlyingTargetInstance
for the controller, and then attach functions to handle the input events.
See below for the script I was using to test this out. Note I used a parent.one
rather than parent.on
to make sure we only attach one handler for the input change event.
const hand_colour_triggerOff = symbol.controllers.hand_colour.elements.triggerOff;
const hand_colour_triggerOn = symbol.controllers.hand_colour.elements.triggerOn;
parent.one("seen", instance => {
var input = instance.booleanInput('slider');
if(!input) return;
input.on("change", value => {
if(value) {
hand_colour_triggerOn.activate();
} else {
hand_colour_triggerOff.activate();
}
});
});
You can see this in context in the modified ZapBox template here:
ZapBox Demo With Trigger.zpp (3.5 MB)
We will update Studio’s ZapBox wrappers to expose the trigger inputs in an easier way in a future version, but I hope this helps you out in the short term.
The earlier demo project I posted here shows the full input API and has more comments to describe it, but this one was more about trying to hook into the input events using the current Studio ZapBox support.