Troubleshooting

Custom address / Packing OSC messages

Started by ianjgrant on .

Sign in or create an account to join the conversation.

4 posts

Topic starter
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:
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
Hi, Ian.

Attaching the multiline script to the multiball object did the trick:
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.