# Tangible Engine v1.5 (Legacy)
The Tangible Engine is a library that processes discrete touch events passed in by the user and recognizes tangible patterns. Once a known pattern is recognized, the user begins receiving notifications of the tangible's state until the end of the tangible's lifetime. When using the Tangible Engine, the user must point the library to a patterns file that contains the patterns of trained tangibles and their names. The Tangible Engine supports a range of Ideum multitouch tables each with different pixel densities. For each table there exists a preset tangible patterns file that contains the standard patterns that come with the Tangible Engine. If you are not making your own patterns as described in the 3d printing section, then these preset files are the only ones you will need.
The SDK is divided into the following directories:
bincontains the DLLs required to use the Tangible Engine
tangible_trainer_qtcontains the binaries for the Tangible Engine Configuration Utility
bindingscontains the QML, Unity and C++ bindings
pattern_file_presetscontains pattern files for the range of tables supported by the Tangible Engine.
demoscontains example projects illustrating how the different bindings are used
# Using the Tangible Engine from C/C++
The primary method of writing an application that uses the Tangible Engine is through the provided C++ bindings, although it is possible to create bindings for other languages using the DLL. To use the Tangible Engine, perform the following steps:
tangible_tracker.libto your project
- Direct the tracker to a patterns file using the
- Pass touch data to the Tangible Engine using the
- Use the function
TE_GetTangiblesto get the current state of all tracked tangibles
# Using the Tangible Engine from QML
The QML API is identical to the C API. To use the Tangible Engine, perform the following steps:
tangible_engine.hfrom the QML bindings folder to your project. Add
tangible_tracker.dll, and your patterns file to your build directory.
tangible_engine.hin your project and obtain an instance of the Tangible Engine through
TangibleEngine::getInstance. Register this instance as a singleton with QML.
- Direct the tracker to a patterns file using the method
- Pass touch data to the Tangible Engine using the method
- Use the
TangibleEngine.getTangiblesfunction to get the current state of all tracked tangibles.
See the QML demo for more details.
The QML demo was built with Qt5.7 and the Microsoft Visual C++ 2013 compiler. If you are using a different version of either tool, a different build directory will be created. You must place the
tangible_tracker.dll, and the patterns file in this new folder.
# Using the Tangible Engine from C#
The Unity bindings for the Tangible Engine consists of two files,
Tangible.cs. To use the Tangible Engine with Unity, perform the following steps:
tangible_tracker.dlland your patterns file to your Unity project's asset folder
- Create a game object in your Unity scene, name it
TangibleEngine. and add the script
TangibleEngine.csto it. Set the Patterns File property of the TangibleEngine game object to the path of your patterns file. The default value is
- Add the script
Tangible.csto any object that you want to be controlled by a tangible. Set the patternName property of the Tangible script to the name of the pattern you want to associate with your game object.
For a working example, see the Unity demo that comes with the SDK.
# Using the Tangible Engine from Electron
The Node.js binding to Tangible Engine consists of a single file
tangible_engine.js, which defines a single function named
getTangibleEngine function depends on the
ref-array addons. To install these, add
ref-array to your Electron app's package dependencies and run
npm install. Since Electron uses a different version of V8 than Node.js, any native addons used by your Electron app must be recompiled to target Electron's runtime. To do this, run the following commands:
npm install --save-dev electron-rebuild
See the Electron demo for more info.
# The Node.js API
getTangibleEngine takes the path of the tangible tracker DLL and returns an object with methods to access the Tangible Engine.
For example, using the Tangible Engine with an HTML5 canvas might look like:
var TangibleEngine = getTangibleEngine(); TangibleEngine.init(); TangibleEngine.setPatternsFile('tangible_patterns_55.json'); // ... on touchstart TangibleEngine.processTouchEvent(true, touch.identifier, touch.clientX, touch.clientY) // ... on touchmove TangibleEngine.processTouchEvent(true, touch.identifier, touch.clientX, touch.clientY) // ... on touchend TangibleEngine.processTouchEvent(false, touch.identifier, touch.clientX, touch.clientY) // ... in an update loop that is called frequrently (e.g. 30hz, 60hz) var tangibles = TangibleEngine.getTangibles(); // do something with tangibles