VR Tracker Tags come with a GPIO port. What for ? Mostly so you can plug in buttons, triggers, sensors and other devices, and directly use VR Tracker ecosystem to create a tracked controller, weapon for a lasertag, and many other applications that you must be already thinking about.
In this tutorial we will simply add a button to the Tag, and see how we can retrieve the information.
1. Get the components
To add a switch you only need 3 components :
- A switch (that one seemed obvious right ?…)
- A 10kΩ resistor
- Wire (jumper cables)
2. Connect everything together
Here is how to wire everything up. The circuit is pretty simple, it’s just a switch with a pull down resistor.
3. Get the Data
To retrieve the data, you can check the API : a User can receive “special commands”. Button press are part of those special command. In the current software revision (tag version 0.8, from the 05/01/2017), when the button is pressed, the Users connected to the Tag will receive a special command with the data “triggeron”, and when it is release “triggeroff”.
RECEIVE Tag X Special Command
“cmd=specialcmd&uid=TAG_ID&data=myspecialdata”uid : String (Tag ID)
data : String
Those are special commands that can be defined by the user in the Tag software. This is used when the Tag has been modified into a controller (see below).
You will receive :
On press
cmd=specialcmd&uid=TAG_ID&data=triggeron
On release
cmd=specialcmd&uid=TAG_ID&data=triggeroff
One Comment
VR Tracker - Tracking technology for Multiplayer VR - Unity Plugin V2
[…] script make use of extra Tag Button (more informations on adding a button the your Tag here), to select, drag and drop objects in your virtual environment. It can easily become a sandbox to […]