InteractiveScapeGmbH / TuioUnityClient

MIT License
14 stars 2 forks source link

TUIO 2.0 Documentation #12

Open av-pong opened 1 month ago

av-pong commented 1 month ago

Is there documentation for the plugin anywhere other than the readme on GitHub? For example, I would like to know how to use boundaries or query token IDs.

eqbic commented 1 month ago

hey, there is no documentation besides the readme on github yet. but it is planned to provide one of course.

concerning your question, the entry point to get information about tuio entities is (for tuio 2.0) the Tuio20Dispatcher class. (see the Tuio20Visualizer component as an example)

Tuio20Dispatcher provide some events which gets invoked when a tuio entity was added, updated or removed. to get a new TuioBounds object you can use (more or less pseudocode, just to get an idea):

var dispatcher = (Tuio20Dispatcher)_tuioSessionBehaviour.TuioDispatcher;
dispatcher.OnObjectAdd  += ReactOnNewObject;

private void ReactOnNewObject(object sender, Tuio20Object tuioObject)
{
    if(tuioObject.ContainsNewTuioBounds())
    {
        var bounds = tuioObject.Bounds;
        // do something with bounds
    }
}

you can also get a list for each tuio type:

dispatcher.GetTuioBounds();
dispatcher.GetTuioPointer();
dispatcher.GetTuioTokens();
dispatcher.GetTuioSymbols();

I hope this will help you for now until I provide a better documentation.