2dblb TouchScript for Unity
- Wednesday, 04 March 2015
- Monday, 24 April 2017
TouchScript for Unity modified to use 2dblb information as well as 2dcur. This allows access to blob position, size (height and width), angle, velocity (x and y), speed, and more!
This is a Unity Package, so you can just drag and drop into a Unity Project. There is an example scene to illustrate basic usage.
TUIO information can be sent using 3 basic profiles. The most common of these is 2dcur (2d Cursor). 2dcur is capable of sending x and y coordinates and information on velocity and acceleration, but typically only the position information is attached. Typical Windows Touch, Tablet, and smartphone events contain only this info. The latest TouchScript uses this info, but goes much further by adding hit detection, last position information, and gesture/cluster recognition.
Another profile, 2dblb (2d Blob), has much more information in its packets. It can tell Unity information on the width, height, area, angle of rotation, and motion/rotational velocities/acceleration. Although there were easier implementations of 2dblb in Unity, it seemed a shame to move away from TouchScript's wonderful functionality. Augmenting TouchScript with this information was a little trickier for us, but well worth it.
If you are familiar with TouchScript, you will be delighted to see that this package gives you access to the Area (float), Size (Vector2), Angle (float), Velocity (Vector2), and Speed (float) as well as the standard Position, LastPosition, Hit, Layer, etc. There is a demo script called Tester in the package. Attach to the main Camera. In the inspector for the script, set Box to GreenBox and set Texture to Touch. Don't forget to add your TouchScript Object to the scene (an Empty Object with TUIO Input and Mouse Input components).
Thanks to the hard work of the lovely and talented Joe Weber, the latest BigBlobby now gives you the option of using 2dcur, 2dblb, or both!
There is still more information that we will add in future revisions, as well as the 2dobj profile.