Custom address / Packing OSC messages

Discuss problems and solutions.
Post Reply
ianjgrant
Newbie
Posts: 4
Joined: 08 Nov 2013 21:14

Custom address / Packing OSC messages

Post by ianjgrant »

Hi, I'm new to Lemur and I am presently using TouchOSC to talk to a Unity3D app.

At the moment I can't see how the message receive loop I have in Unity will work with the address / message style of the Lemur. and as the experience I am designing is controlled by multiple ipads, it would be ideal to have a single format out of both controllers:

For example:
From TouchOSC I receive the code in unity like this:

Code: Select all

if (address == "/2/multiXYController/1") {  // 1 is the first touch
			float x1 = (float) args[0];  
			float y1 = (float) args[1]; 
			//... move the transform of an object
}
The lemur - for example the multiball - sends x y and z values as separate messages with the touch ID the index of the variable x[0], x[1] etc.

How can I 'pack' the x y z message up into a single address and access each parameter with the argument array approach as above? And maybe with the object index in the address?

I think I may could do that with a script in Lemur to collect the values and use OSCOut() to construct a new formatted message.
Maybe I could use OSCulator to reformat the message? But that would get unwieldy.

Maybe I should understand a little more how my OSC receiver is working in Unity! (I'm using OSC.net) and amazed I've got it working so far!

Any points would be welcomed... thanks in advance.

Kind regards, Ian
ianjgrant
Newbie
Posts: 4
Joined: 08 Nov 2013 21:14

Re: Custom address / Packing OSC messages

Post by ianjgrant »

Hi, Ian.

Attaching the multiline script to the multiball object did the trick:

Code: Select all

oscout(0, '/1/Pad2PuppetController1/1',{x[0],y[0],z[0]});
oscout(0, '/1/Pad2PuppetController1/1',{x[1],y[1],z[1]});
oscout(0, '/1/Pad2PuppetController1/1',{x[2],y[2],z[2]});
oscout(0, '/1/Pad2PuppetController1/1',{x[3],y[3],z[3]});
oscout(0, '/1/Pad2PuppetController1/1',{x[4],y[4],z[4]});
and the ball physics is sending beautifully to Unity! I'm starting to get this and I am very excited by the lemur!

from Ian xxx

ps. Sorry to have asked and answered my own question. Didn't think I'd get it so quickly.
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Custom address / Packing OSC messages

Post by Macciza »

Hi
Even though you've worked it out you might still want to have a look at this http://liine.net/en/community/user-library/view/152/ . . .
Also remember to watch out for typos - Should the address be the same for all those values - or should the last digit increment as well??

Cheers
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
ianjgrant
Newbie
Posts: 4
Joined: 08 Nov 2013 21:14

Re: Custom address / Packing OSC messages

Post by ianjgrant »

Hi, Many thanks for the link that looks very useful and the heads up about the pseudo code - you are quite right the final number of the address is the touch index and should increment. Kind regards Ian
Post Reply