| 12 November 2009
Yet another brain child of Sandor’s: uniTUIO. We are using the Unity3D engine to be ale to more rapidly develop very cool interactive apps. But first we need to develop a nice set of scripts to sit between the TUIO input stream and the unity objects.
As always, we start with some code from the reactivision folks, specifically the c# TUIO implementation by Martin Kaltenbrunner. This takes care of all the nitty gritty OSC and TUIO message unpacking. What comes out of that pipeline is raw TUIO objects.
Here is a very early screencast of some multi-touch handling. In the video, I am using the mouse to simulate the multi-touch events, but it works with TUIO inputs as well.
That is where uniTUIO comes in. This is a set of c# scripts that handles the TUIO input events and figures out what objects have been hit and distributes the touch events accordingly. It is very Unity specific, and is basically the glue between TUIO and the unity game loop. I designed it with the NSResponder chain design in mind. There is a singleton event manager that deals with the raw events. It has a list of event responder objects. When an event comes in the event manager figured out which responder should get that event notification and it passes it on. It works very much like the Cocoa Touch multi-touch model on the iPhone.
At the next level, there are scripts to make objects ‘Touchable objects’ these scripts handle registering with the event manager to become a touch responder and all of that event handshaking then all you need to do in your child scripts is implement some touchDown, touchMoved and touchEnded delegate methods.
Easy!
