Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

OSC multiple clients

$
0
0

HI,

I'm making a game with 3 computers (1 server en two clients). And when I use the following code i will get an error. And when I remove the float or the int, that one function will work, but when they are both active, it gives an error. I believe it has something to do with the string position, but I have no idea.

the error: ERROR @ OscP5 ERROR. an error occured while forwarding an OscMessage to a method in your program. please check your code for any possible errors that might occur in the method where incoming OscMessages are parsed e.g. check for casting errors, possible nullpointers, array overflows ... . method in charge : oscEvent java.lang.reflect.InvocationTargetException

My code:

import oscP5.*; import netP5.*;

OscP5 oscP5; NetAddress pilot, gunner;

int shoot; float deg;

void setup() { size (1000, 1000);

oscP5 = new OscP5(this,12002); pilot = new NetAddress("localhost",12001); gunner = new NetAddress("localhost",12000); }

void oscEvent(OscMessage theOscMessage){ //print("Received an osc message"); String msgType = theOscMessage.addrPattern();

float degValue = theOscMessage.get(0).floatValue();

if(msgType.equals("/shoot")) { int shootValue = theOscMessage.get(0).intValue(); shoot = shootValue; }

if(msgType.equals("/deg")) {

deg = degValue; }

}


Viewing all articles
Browse latest Browse all 2896

Trending Articles