Using the triggers on the ZapBox Carboard Controllers?


Right now, the ZapBox experience that I am working on involves moving a controller to directly interact with a button in my scene.

Is there a way to have a raycaster emit a laser and then use the trigger on the carboard controller to activate the button from a distance rather than having the controller interact directly with it?


Yes you can. You just have to have a variable for the raycaster when it hits your buttons. And one for the zapbox controller trigger. If both are true (or on) then activate button.

Or I played with adding 4 thin plans each 180 to each other to make a X. Then have a trigger on the tip.



Thank you. Two things that I am still confused about.

  1. So when I add a raycaster, it is essentially like an invisible line emitting along the direction of purple arrow I see in the 3D view. As it says in the documentation, this purple arrow isn’t rendered in preview or published views. So do I bring in my own laser asset to extend out from the controller that follows the path of the purple arrow?

  2. I have looked and looked and I can’t seem to find any information for how to incorporate the trigger button on the cardboard controllers. Where is this value located?


Ok so for your first question… How you let the user know where the pointer is going you can add your laser pointer, you could have a small line coming out of the controller to help point them, you could have a spot light pointing off the controller. Here is a video of the zappar zapbox in house hackathon. It can give you some ideas.

As for your 2nd here is the post on how to use then triggers.



Awesome! Thank you so much. I am very new to scripting, so it takes a bit of tinkering to figure out what is doing what. I figured out how to activate my own controller states by tweaking the scripting in the example project.

However, I don’t really understand what all the scripting is doing in the example project. For instance, I noticed that my controller button is a bit finicky when it comes to activating. As I understand it, the position of the black ring on the cardboard controller that moves up and down is tracked and has a value associated with its position as the trigger is pressed in and it moves.

In the example, when the black ring on the cardboard controller reaches the top then the green square is activated. However, my black ring doesn’t always move high enough on the cardboard controller to activate the green square. Can I lower the threshold just a bit so that the ring doesn’t have to move up so far before it activates the controller states in the script?

Also, have they released any example projects that show how you can have the controller grab different assets in a scene? So if I had a 3D model for instance, and I wanted the controller to be able to grab it and move it, how would I do that?

Thank you again for all your help. Without any previous scripting experience, figuring this stuff out is a bit tricky. I’m starting to get the hang of it a bit though. :slight_smile:


Sorry should have given you this one. It has a on/ off code. it helps with the bouncing.

Yes there is a demo of the grabbing 3D models with the controller. I can’t remember if they shared the code for it yet or not. . I know they move it between (relative to ) the zapbox world and the controller.

It’s taken me 3 years and I’m still learning as I go :wink:



Just found the post for it.



You’ve been a big help Steve! I appreciate it.

So I take it they haven’t released the code that shows how they move an object between being connected to the Zapbox World and the controller? I see that he mentions the xylophone project doing this. They didn’t make that available for download did they?

I noticed that there are two values in an object’s Transform properties " Relative to" and “Relative to Prop”. Are these the values that are being used in grabbing or are these for something else?


Yes the ZapBox Xylophone Project File is here,
The controllers are the wand you use to hit the keys on the Xylophone. Now there is a 3d model that is being moved by the controller with code. It make it look like the controller is the wand but really it all done but coding.

When you use Relative to each item has its own space (world) it lives in. When you move say the controller you can get it’s space values Relative to the ZapBox world Map. Now you need to know where the 3d model is in the world and when the controllers values match to make contact.

There’s a lot to it. I still haven’t really coded it out.

Glad to help :smile: