//4Wiimotes2OSC //by Olivier Baudu //http://www.yamatierea.org/papatchs //for Labomedia //http://www.labomedia.net //Darwiinremote emulator //by cdriko@free.fr //from //Mouse Control Script //by vkapadia //vkapadia@vkapadia.com // LED P1 Wiimote.LED1 = true; Wiimote.LED2 = false; Wiimote.LED3 = false; Wiimote.LED4 = false; // LED P2 Wiimote2.LED1 = false; Wiimote2.LED2 = true; Wiimote2.LED3 = false; Wiimote2.LED4 = false; // LED P3 Wiimote3.LED1 = false; Wiimote3.LED2 = false; Wiimote3.LED3 = true; Wiimote3.LED4 = false; // LED P4 Wiimote4.LED1 = false; Wiimote4.LED2 = false; Wiimote4.LED3 = false; Wiimote4.LED4 = true; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////WIIMOTE 1/////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //OSC var.Wiimote.host = "localhost" var.Wiimote.ProcessingPort = 5600 //Calibration: var.Wiimote.trimx = 1.5 var.Wiimote.trimy = -28.5 var.Wiimote.trimz = 0.5 if Wiimote.Up if var.Wiimote.Up!=1 var.Wiimote.Up=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/up", int( var.Wiimote.Up)) endif else if var.Wiimote.Up!=0 var.Wiimote.Up=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/up", int( var.Wiimote.Up)) endif endif if Wiimote.Down if var.Wiimote.Down!=1 var.Wiimote.Down=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/down", int( var.Wiimote.Down)) endif else if var.Wiimote.Down!=0 var.Wiimote.Down=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/down", int( var.Wiimote.Down)) endif endif if Wiimote.Left if var.Wiimote.Left!=1 var.Wiimote.Left=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/left", int( var.Wiimote.Left)) endif else if var.Wiimote.Left!=0 var.Wiimote.Left=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/left", int( var.Wiimote.Left)) endif endif if Wiimote.Right if var.Wiimote.Right!=1 var.Wiimote.Right=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/right", int( var.Wiimote.Right)) endif else if var.Wiimote.Right!=0 var.Wiimote.Right=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/right", int( var.Wiimote.Right)) endif endif if Wiimote.A if var.Wiimote.A!=1 var.Wiimote.A=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/a", int( var.Wiimote.A)) endif else if var.Wiimote.A!=0 var.Wiimote.A=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/a", int( var.Wiimote.A)) endif endif if Wiimote.B if var.Wiimote.B!=1 var.Wiimote.B=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/b", int( var.Wiimote.B)) endif else if var.Wiimote.B!=0 var.Wiimote.B=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/b", int( var.Wiimote.B)) endif endif if Wiimote.Home if var.Wiimote.Home!=1 var.Wiimote.Home=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/home", int( var.Wiimote.Home)) endif else if var.Wiimote.Home!=0 var.Wiimote.Home=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/home", int( var.Wiimote.Home)) endif endif if Wiimote.minus if var.Wiimote.minus!=1 var.Wiimote.minus=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/minus", int( var.Wiimote.minus)) endif else if var.Wiimote.minus!=0 var.Wiimote.minus=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/minus", int( var.Wiimote.minus)) endif endif if Wiimote.plus if var.Wiimote.plus!=1 var.Wiimote.plus=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/plus", int( var.Wiimote.plus)) endif else if var.Wiimote.plus!=0 var.Wiimote.plus=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/plus", int( var.Wiimote.plus)) endif endif if Wiimote.One if var.Wiimote.One!=1 var.Wiimote.One=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/one", int( var.Wiimote.One)) endif else if var.Wiimote.One!=0 var.Wiimote.One=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/one", int( var.Wiimote.One)) endif endif if Wiimote.Two if var.Wiimote.Two!=1 var.Wiimote.Two=1 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/two", int( var.Wiimote.Two)) endif else if var.Wiimote.Two!=0 var.Wiimote.Two=0 SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/button/two", int( var.Wiimote.Two)) endif endif /// var.Wiimote.x = Wiimote.RawForceX + var.Wiimote.trimx var.Wiimote.y = Wiimote.RawForceY + var.Wiimote.trimy var.Wiimote.z = Wiimote.RawForceZ + var.Wiimote.trimz SendOsc(var.Wiimote.host, var.Wiimote.ProcessingPort, "/wii400/acc", float(var.Wiimote.x ), float(var.Wiimote.y ), float(var.Wiimote.z )) SendOsc(var.Wiimote.host,var.Wiimote.ProcessingPort,"/wii400/orientation", float(Wiimote.Roll),float(-Wiimote.Pitch)) //precision var.Wiimote.sense0 = 500 var.Wiimote.thresh0x = 5 var.Wiimote.thresh0y = 2 var.Wiimote.sense = 300 var.Wiimote.threshx = 10 var.Wiimote.threshy = 5 var.Wiimote.sense2 = 100 var.Wiimote.thresh2x = 15 var.Wiimote.thresh2y = 8 var.Wiimote.sense3 = 50 var.Wiimote.thresh3x = 20 var.Wiimote.thresh3y = 12 //first sensitivity setting //xaxis if var.Wiimote.x > var.Wiimote.thresh0x var.Wiimote.Posx = var.Wiimote.Posx - 1/var.Wiimote.sense0 endif if var.Wiimote.x < -var.Wiimote.thresh0x var.Wiimote.Posx = var.Wiimote.Posx + 1/var.Wiimote.sense0 endif //yaxis if var.Wiimote.z > var.Wiimote.thresh0y var.Wiimote.Posy = var.Wiimote.Posy - 1/var.Wiimote.sense0 endif if var.Wiimote.z < -var.Wiimote.thresh0y var.Wiimote.Posy = var.Wiimote.Posy + 1/var.Wiimote.sense0 endif //second sensitivity setting //xaxis if var.Wiimote.x > var.Wiimote.threshx var.Wiimote.Posx = var.Wiimote.Posx - 1/var.Wiimote.sense endif if var.Wiimote.x < -var.Wiimote.threshx var.Wiimote.Posx = var.Wiimote.Posx + 1/var.Wiimote.sense endif //yaxis if var.Wiimote.z > var.Wiimote.threshy var.Wiimote.Posy = var.Wiimote.Posy - 1/var.Wiimote.sense endif if var.Wiimote.z < -var.Wiimote.threshy var.Wiimote.Posy = var.Wiimote.Posy + 1/var.Wiimote.sense endif //third sensitivity setting //xaxis if var.Wiimote.x > var.Wiimote.thresh2x var.Wiimote.Posx = var.Wiimote.Posx - 1/var.Wiimote.sense2 endif if var.Wiimote.x < -var.Wiimote.thresh2x var.Wiimote.Posx = var.Wiimote.Posx + 1/var.Wiimote.sense2 endif //yaxis if var.Wiimote.z > var.Wiimote.thresh2y var.Wiimote.Posy = var.Wiimote.Posy - 1/var.Wiimote.sense2 endif if var.Wiimote.z < -var.Wiimote.thresh2y var.Wiimote.Posy = var.Wiimote.Posy + 1/var.Wiimote.sense2 endif //fourth sensitivity setting //xaxis if var.Wiimote.x > var.Wiimote.thresh3x var.Wiimote.Posx = var.Wiimote.Posx - 1/var.Wiimote.sense3 endif if var.Wiimote.x < -var.Wiimote.thresh3x var.Wiimote.Posx = var.Wiimote.Posx + 1/var.Wiimote.sense3 endif //yaxis if var.Wiimote.z > var.Wiimote.thresh3y var.Wiimote.Posy = var.Wiimote.Posy - 1/var.Wiimote.sense3 endif if var.Wiimote.z < -var.Wiimote.thresh3y var.Wiimote.Posy = var.Wiimote.Posy + 1/var.Wiimote.sense3 endif SendOsc(var.Wiimote.host, var.Wiimote.ProcessingPort, "/wii400/point", float(var.Wiimote.Posx), float(var.Wiimote.Posy)) //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////WIIMOTE 2/////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //OSC var.Wiimote2.host = "localhost" var.Wiimote2.ProcessingPort = 5600 //Calibration: var.Wiimote2.trimx = 1.5 var.Wiimote2.trimy = -28.5 var.Wiimote2.trimz = 0.5 if Wiimote2.Up if var.Wiimote2.Up!=1 var.Wiimote2.Up=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/up", int( var.Wiimote2.Up)) endif else if var.Wiimote2.Up!=0 var.Wiimote2.Up=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/up", int( var.Wiimote2.Up)) endif endif if Wiimote2.Down if var.Wiimote2.Down!=1 var.Wiimote2.Down=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/down", int( var.Wiimote2.Down)) endif else if var.Wiimote2.Down!=0 var.Wiimote2.Down=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/down", int( var.Wiimote2.Down)) endif endif if Wiimote2.Left if var.Wiimote2.Left!=1 var.Wiimote2.Left=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/left", int( var.Wiimote2.Left)) endif else if var.Wiimote2.Left!=0 var.Wiimote2.Left=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/left", int( var.Wiimote2.Left)) endif endif if Wiimote2.Right if var.Wiimote2.Right!=1 var.Wiimote2.Right=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/right", int( var.Wiimote2.Right)) endif else if var.Wiimote2.Right!=0 var.Wiimote2.Right=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/right", int( var.Wiimote2.Right)) endif endif if Wiimote2.A if var.Wiimote2.A!=1 var.Wiimote2.A=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/a", int( var.Wiimote2.A)) endif else if var.Wiimote2.A!=0 var.Wiimote2.A=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/a", int( var.Wiimote2.A)) endif endif if Wiimote2.B if var.Wiimote2.B!=1 var.Wiimote2.B=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/b", int( var.Wiimote2.B)) endif else if var.Wiimote2.B!=0 var.Wiimote2.B=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/b", int( var.Wiimote2.B)) endif endif if Wiimote2.Home if var.Wiimote2.Home!=1 var.Wiimote2.Home=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/home", int( var.Wiimote2.Home)) endif else if var.Wiimote2.Home!=0 var.Wiimote2.Home=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/home", int( var.Wiimote2.Home)) endif endif if Wiimote2.minus if var.Wiimote2.minus!=1 var.Wiimote2.minus=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/minus", int( var.Wiimote2.minus)) endif else if var.Wiimote2.minus!=0 var.Wiimote2.minus=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/minus", int( var.Wiimote2.minus)) endif endif if Wiimote2.plus if var.Wiimote2.plus!=1 var.Wiimote2.plus=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/plus", int( var.Wiimote2.plus)) endif else if var.Wiimote2.plus!=0 var.Wiimote2.plus=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/plus", int( var.Wiimote2.plus)) endif endif if Wiimote2.One if var.Wiimote2.One!=1 var.Wiimote2.One=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/one", int( var.Wiimote2.One)) endif else if var.Wiimote2.One!=0 var.Wiimote2.One=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/one", int( var.Wiimote2.One)) endif endif if Wiimote2.Two if var.Wiimote2.Two!=1 var.Wiimote2.Two=1 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/two", int( var.Wiimote2.Two)) endif else if var.Wiimote2.Two!=0 var.Wiimote2.Two=0 SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/button/two", int( var.Wiimote2.Two)) endif endif /// //****Everything past here deals with mouse movement***** // set these to the offsets when the wiimote is at rest // will be different for each wiimote most likely var.Wiimote2.x = Wiimote2.RawForceX + var.Wiimote2.trimx var.Wiimote2.y = Wiimote2.RawForceY + var.Wiimote2.trimy var.Wiimote2.z = Wiimote2.RawForceZ + var.Wiimote2.trimz SendOsc(var.Wiimote2.host, var.Wiimote2.ProcessingPort, "/wii401/acc", float(var.Wiimote2.x ), float(var.Wiimote2.y ), float(var.Wiimote2.z )) SendOsc(var.Wiimote2.host,var.Wiimote2.ProcessingPort,"/wii401/orientation", float(Wiimote2.Roll),float(-Wiimote2.Pitch)) //precision var.Wiimote2.sense0 = 500 var.Wiimote2.thresh0x = 5 var.Wiimote2.thresh0y = 2 var.Wiimote2.sense = 300 var.Wiimote2.threshx = 10 var.Wiimote2.threshy = 5 var.Wiimote2.sense2 = 100 var.Wiimote2.thresh2x = 15 var.Wiimote2.thresh2y = 8 var.Wiimote2.sense3 = 50 var.Wiimote2.thresh3x = 20 var.Wiimote2.thresh3y = 12 //first sensitivity setting //xaxis if var.Wiimote2.x > var.Wiimote2.thresh0x var.Wiimote2.Posx = var.Wiimote2.Posx - 1/var.Wiimote2.sense0 endif if var.Wiimote2.x < -var.Wiimote2.thresh0x var.Wiimote2.Posx = var.Wiimote2.Posx + 1/var.Wiimote2.sense0 endif //yaxis if var.Wiimote2.z > var.Wiimote2.thresh0y var.Wiimote2.Posy = var.Wiimote2.Posy - 1/var.Wiimote2.sense0 endif if var.Wiimote2.z < -var.Wiimote2.thresh0y var.Wiimote2.Posy = var.Wiimote2.Posy + 1/var.Wiimote2.sense0 endif //second sensitivity setting //xaxis if var.Wiimote2.x > var.Wiimote2.threshx var.Wiimote2.Posx = var.Wiimote2.Posx - 1/var.Wiimote2.sense endif if var.Wiimote2.x < -var.Wiimote2.threshx var.Wiimote2.Posx = var.Wiimote2.Posx + 1/var.Wiimote2.sense endif //yaxis if var.Wiimote2.z > var.Wiimote2.threshy var.Wiimote2.Posy = var.Wiimote2.Posy - 1/var.Wiimote2.sense endif if var.Wiimote2.z < -var.Wiimote2.threshy var.Wiimote2.Posy = var.Wiimote2.Posy + 1/var.Wiimote2.sense endif //third sensitivity setting //xaxis if var.Wiimote2.x > var.Wiimote2.thresh2x var.Wiimote2.Posx = var.Wiimote2.Posx - 1/var.Wiimote2.sense2 endif if var.Wiimote2.x < -var.Wiimote2.thresh2x var.Wiimote2.Posx = var.Wiimote2.Posx + 1/var.Wiimote2.sense2 endif //yaxis if var.Wiimote2.z > var.Wiimote2.thresh2y var.Wiimote2.Posy = var.Wiimote2.Posy - 1/var.Wiimote2.sense2 endif if var.Wiimote2.z < -var.Wiimote2.thresh2y var.Wiimote2.Posy = var.Wiimote2.Posy + 1/var.Wiimote2.sense2 endif //fourth sensitivity setting //xaxis if var.Wiimote2.x > var.Wiimote2.thresh3x var.Wiimote2.Posx = var.Wiimote2.Posx - 1/var.Wiimote2.sense3 endif if var.Wiimote2.x < -var.Wiimote2.thresh3x var.Wiimote2.Posx = var.Wiimote2.Posx + 1/var.Wiimote2.sense3 endif //yaxis if var.Wiimote2.z > var.Wiimote2.thresh3y var.Wiimote2.Posy = var.Wiimote2.Posy - 1/var.Wiimote2.sense3 endif if var.Wiimote2.z < -var.Wiimote2.thresh3y var.Wiimote2.Posy = var.Wiimote2.Posy + 1/var.Wiimote2.sense3 endif SendOsc(var.Wiimote2.host, var.Wiimote2.ProcessingPort, "/wii401/point", float(var.Wiimote2.Posx), float(var.Wiimote2.Posy)) //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////WIIMOTE 3/////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //OSC var.Wiimote3.host = "localhost" var.Wiimote3.ProcessingPort = 5600 //Calibration: var.Wiimote3.trimx = 1.5 var.Wiimote3.trimy = -28.5 var.Wiimote3.trimz = 0.5 if Wiimote3.Up if var.Wiimote3.Up!=1 var.Wiimote3.Up=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/up", int( var.Wiimote3.Up)) endif else if var.Wiimote3.Up!=0 var.Wiimote3.Up=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/up", int( var.Wiimote3.Up)) endif endif if Wiimote3.Down if var.Wiimote3.Down!=1 var.Wiimote3.Down=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/down", int( var.Wiimote3.Down)) endif else if var.Wiimote3.Down!=0 var.Wiimote3.Down=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/down", int( var.Wiimote3.Down)) endif endif if Wiimote3.Left if var.Wiimote3.Left!=1 var.Wiimote3.Left=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/left", int( var.Wiimote3.Left)) endif else if var.Wiimote3.Left!=0 var.Wiimote3.Left=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/left", int( var.Wiimote3.Left)) endif endif if Wiimote3.Right if var.Wiimote3.Right!=1 var.Wiimote3.Right=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/right", int( var.Wiimote3.Right)) endif else if var.Wiimote3.Right!=0 var.Wiimote3.Right=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/right", int( var.Wiimote3.Right)) endif endif if Wiimote3.A if var.Wiimote3.A!=1 var.Wiimote3.A=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/a", int( var.Wiimote3.A)) endif else if var.Wiimote3.A!=0 var.Wiimote3.A=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/a", int( var.Wiimote3.A)) endif endif if Wiimote3.B if var.Wiimote3.B!=1 var.Wiimote3.B=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/b", int( var.Wiimote3.B)) endif else if var.Wiimote3.B!=0 var.Wiimote3.B=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/b", int( var.Wiimote3.B)) endif endif if Wiimote3.Home if var.Wiimote3.Home!=1 var.Wiimote3.Home=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/home", int( var.Wiimote3.Home)) endif else if var.Wiimote3.Home!=0 var.Wiimote3.Home=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/home", int( var.Wiimote3.Home)) endif endif if Wiimote3.minus if var.Wiimote3.minus!=1 var.Wiimote3.minus=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/minus", int( var.Wiimote3.minus)) endif else if var.Wiimote3.minus!=0 var.Wiimote3.minus=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/minus", int( var.Wiimote3.minus)) endif endif if Wiimote3.plus if var.Wiimote3.plus!=1 var.Wiimote3.plus=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/plus", int( var.Wiimote3.plus)) endif else if var.Wiimote3.plus!=0 var.Wiimote3.plus=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/plus", int( var.Wiimote3.plus)) endif endif if Wiimote3.One if var.Wiimote3.One!=1 var.Wiimote3.One=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/one", int( var.Wiimote3.One)) endif else if var.Wiimote3.One!=0 var.Wiimote3.One=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/one", int( var.Wiimote3.One)) endif endif if Wiimote3.Two if var.Wiimote3.Two!=1 var.Wiimote3.Two=1 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/two", int( var.Wiimote3.Two)) endif else if var.Wiimote3.Two!=0 var.Wiimote3.Two=0 SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/button/two", int( var.Wiimote3.Two)) endif endif /// //****Everything past here deals with mouse movement***** // set these to the offsets when the wiimote is at rest // will be different for each wiimote most likely var.Wiimote3.x = Wiimote3.RawForceX + var.Wiimote3.trimx var.Wiimote3.y = Wiimote3.RawForceY + var.Wiimote3.trimy var.Wiimote3.z = Wiimote3.RawForceZ + var.Wiimote3.trimz SendOsc(var.Wiimote3.host, var.Wiimote3.ProcessingPort, "/wii410/acc", float(var.Wiimote3.x ), float(var.Wiimote3.y ), float(var.Wiimote3.z )) SendOsc(var.Wiimote3.host,var.Wiimote3.ProcessingPort,"/wii410/orientation", float(Wiimote3.Roll),float(-Wiimote3.Pitch)) //precision var.Wiimote3.sense0 = 500 var.Wiimote3.thresh0x = 5 var.Wiimote3.thresh0y = 2 var.Wiimote3.sense = 300 var.Wiimote3.threshx = 10 var.Wiimote3.threshy = 5 var.Wiimote3.sense2 = 100 var.Wiimote3.thresh2x = 15 var.Wiimote3.thresh2y = 8 var.Wiimote3.sense3 = 50 var.Wiimote3.thresh3x = 20 var.Wiimote3.thresh3y = 12 //first sensitivity setting //xaxis if var.Wiimote3.x > var.Wiimote3.thresh0x var.Wiimote3.Posx = var.Wiimote3.Posx - 1/var.Wiimote3.sense0 endif if var.Wiimote3.x < -var.Wiimote3.thresh0x var.Wiimote3.Posx = var.Wiimote3.Posx + 1/var.Wiimote3.sense0 endif //yaxis if var.Wiimote3.z > var.Wiimote3.thresh0y var.Wiimote3.Posy = var.Wiimote3.Posy - 1/var.Wiimote3.sense0 endif if var.Wiimote3.z < -var.Wiimote3.thresh0y var.Wiimote3.Posy = var.Wiimote3.Posy + 1/var.Wiimote3.sense0 endif //second sensitivity setting //xaxis if var.Wiimote3.x > var.Wiimote3.threshx var.Wiimote3.Posx = var.Wiimote3.Posx - 1/var.Wiimote3.sense endif if var.Wiimote3.x < -var.Wiimote3.threshx var.Wiimote3.Posx = var.Wiimote3.Posx + 1/var.Wiimote3.sense endif //yaxis if var.Wiimote3.z > var.Wiimote3.threshy var.Wiimote3.Posy = var.Wiimote3.Posy - 1/var.Wiimote3.sense endif if var.Wiimote3.z < -var.Wiimote3.threshy var.Wiimote3.Posy = var.Wiimote3.Posy + 1/var.Wiimote3.sense endif //third sensitivity setting //xaxis if var.Wiimote3.x > var.Wiimote3.thresh2x var.Wiimote3.Posx = var.Wiimote3.Posx - 1/var.Wiimote3.sense2 endif if var.Wiimote3.x < -var.Wiimote3.thresh2x var.Wiimote3.Posx = var.Wiimote3.Posx + 1/var.Wiimote3.sense2 endif //yaxis if var.Wiimote3.z > var.Wiimote3.thresh2y var.Wiimote3.Posy = var.Wiimote3.Posy - 1/var.Wiimote3.sense2 endif if var.Wiimote3.z < -var.Wiimote3.thresh2y var.Wiimote3.Posy = var.Wiimote3.Posy + 1/var.Wiimote3.sense2 endif //fourth sensitivity setting //xaxis if var.Wiimote3.x > var.Wiimote3.thresh3x var.Wiimote3.Posx = var.Wiimote3.Posx - 1/var.Wiimote3.sense3 endif if var.Wiimote3.x < -var.Wiimote3.thresh3x var.Wiimote3.Posx = var.Wiimote3.Posx + 1/var.Wiimote3.sense3 endif //yaxis if var.Wiimote3.z > var.Wiimote3.thresh3y var.Wiimote3.Posy = var.Wiimote3.Posy - 1/var.Wiimote3.sense3 endif if var.Wiimote3.z < -var.Wiimote3.thresh3y var.Wiimote3.Posy = var.Wiimote3.Posy + 1/var.Wiimote3.sense3 endif SendOsc(var.Wiimote3.host, var.Wiimote3.ProcessingPort, "/wii410/point", float(var.Wiimote3.Posx), float(var.Wiimote3.Posy)) //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////WIIMOTE 4/////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //OSC var.Wiimote4.host = "localhost" var.Wiimote4.ProcessingPort = 5600 //Calibration: //Change these values until the debug line says all zeros when the wiimote is at rest. var.Wiimote4.trimx = 1.5 var.Wiimote4.trimy = -28.5 var.Wiimote4.trimz = 0.5 // if Wiimote4.Up if var.Wiimote4.Up!=1 var.Wiimote4.Up=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/up", int( var.Wiimote4.Up)) endif else if var.Wiimote4.Up!=0 var.Wiimote4.Up=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/up", int( var.Wiimote4.Up)) endif endif if Wiimote4.Down if var.Wiimote4.Down!=1 var.Wiimote4.Down=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/down", int( var.Wiimote4.Down)) endif else if var.Wiimote4.Down!=0 var.Wiimote4.Down=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/down", int( var.Wiimote4.Down)) endif endif if Wiimote4.Left if var.Wiimote4.Left!=1 var.Wiimote4.Left=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/left", int( var.Wiimote4.Left)) endif else if var.Wiimote4.Left!=0 var.Wiimote4.Left=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/left", int( var.Wiimote4.Left)) endif endif if Wiimote4.Right if var.Wiimote4.Right!=1 var.Wiimote4.Right=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/right", int( var.Wiimote4.Right)) endif else if var.Wiimote4.Right!=0 var.Wiimote4.Right=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/right", int( var.Wiimote4.Right)) endif endif if Wiimote4.A if var.Wiimote4.A!=1 var.Wiimote4.A=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/a", int( var.Wiimote4.A)) endif else if var.Wiimote4.A!=0 var.Wiimote4.A=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/a", int( var.Wiimote4.A)) endif endif if Wiimote4.B if var.Wiimote4.B!=1 var.Wiimote4.B=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/b", int( var.Wiimote4.B)) endif else if var.Wiimote4.B!=0 var.Wiimote4.B=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/b", int( var.Wiimote4.B)) endif endif if Wiimote4.Home if var.Wiimote4.Home!=1 var.Wiimote4.Home=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/home", int( var.Wiimote4.Home)) endif else if var.Wiimote4.Home!=0 var.Wiimote4.Home=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/home", int( var.Wiimote4.Home)) endif endif if Wiimote4.minus if var.Wiimote4.minus!=1 var.Wiimote4.minus=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/minus", int( var.Wiimote4.minus)) endif else if var.Wiimote4.minus!=0 var.Wiimote4.minus=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/minus", int( var.Wiimote4.minus)) endif endif if Wiimote4.plus if var.Wiimote4.plus!=1 var.Wiimote4.plus=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/plus", int( var.Wiimote4.plus)) endif else if var.Wiimote4.plus!=0 var.Wiimote4.plus=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/plus", int( var.Wiimote4.plus)) endif endif if Wiimote4.One if var.Wiimote4.One!=1 var.Wiimote4.One=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/one", int( var.Wiimote4.One)) endif else if var.Wiimote4.One!=0 var.Wiimote4.One=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/one", int( var.Wiimote4.One)) endif endif if Wiimote4.Two if var.Wiimote4.Two!=1 var.Wiimote4.Two=1 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/two", int( var.Wiimote4.Two)) endif else if var.Wiimote4.Two!=0 var.Wiimote4.Two=0 SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/button/two", int( var.Wiimote4.Two)) endif endif /// //****Everything past here deals with mouse movement***** // set these to the offsets when the wiimote is at rest // will be different for each wiimote most likely var.Wiimote4.x = Wiimote4.RawForceX + var.Wiimote4.trimx var.Wiimote4.y = Wiimote4.RawForceY + var.Wiimote4.trimy var.Wiimote4.z = Wiimote4.RawForceZ + var.Wiimote4.trimz SendOsc(var.Wiimote4.host, var.Wiimote4.ProcessingPort, "/wii411/acc", float(var.Wiimote4.x ), float(var.Wiimote4.y ), float(var.Wiimote4.z )) SendOsc(var.Wiimote4.host,var.Wiimote4.ProcessingPort,"/wii411/orientation", float(Wiimote4.Roll),float(-Wiimote4.Pitch)) //precision var.Wiimote4.sense0 = 500 var.Wiimote4.thresh0x = 5 var.Wiimote4.thresh0y = 2 var.Wiimote4.sense = 300 var.Wiimote4.threshx = 10 var.Wiimote4.threshy = 5 var.Wiimote4.sense2 = 100 var.Wiimote4.thresh2x = 15 var.Wiimote4.thresh2y = 8 var.Wiimote4.sense3 = 50 var.Wiimote4.thresh3x = 20 var.Wiimote4.thresh3y = 12 //first sensitivity setting //xaxis if var.Wiimote4.x > var.Wiimote4.thresh0x var.Wiimote4.Posx = var.Wiimote4.Posx - 1/var.Wiimote4.sense0 endif if var.Wiimote4.x < -var.Wiimote4.thresh0x var.Wiimote4.Posx = var.Wiimote4.Posx + 1/var.Wiimote4.sense0 endif //yaxis if var.Wiimote4.z > var.Wiimote4.thresh0y var.Wiimote4.Posy = var.Wiimote4.Posy - 1/var.Wiimote4.sense0 endif if var.Wiimote4.z < -var.Wiimote4.thresh0y var.Wiimote4.Posy = var.Wiimote4.Posy + 1/var.Wiimote4.sense0 endif //second sensitivity setting //xaxis if var.Wiimote4.x > var.Wiimote4.threshx var.Wiimote4.Posx = var.Wiimote4.Posx - 1/var.Wiimote4.sense endif if var.Wiimote4.x < -var.Wiimote4.threshx var.Wiimote4.Posx = var.Wiimote4.Posx + 1/var.Wiimote4.sense endif //yaxis if var.Wiimote4.z > var.Wiimote4.threshy var.Wiimote4.Posy = var.Wiimote4.Posy - 1/var.Wiimote4.sense endif if var.Wiimote4.z < -var.Wiimote4.threshy var.Wiimote4.Posy = var.Wiimote4.Posy + 1/var.Wiimote4.sense endif //third sensitivity setting //xaxis if var.Wiimote4.x > var.Wiimote4.thresh2x var.Wiimote4.Posx = var.Wiimote4.Posx - 1/var.Wiimote4.sense2 endif if var.Wiimote4.x < -var.Wiimote4.thresh2x var.Wiimote4.Posx = var.Wiimote4.Posx + 1/var.Wiimote4.sense2 endif //yaxis if var.Wiimote4.z > var.Wiimote4.thresh2y var.Wiimote4.Posy = var.Wiimote4.Posy - 1/var.Wiimote4.sense2 endif if var.Wiimote4.z < -var.Wiimote4.thresh2y var.Wiimote4.Posy = var.Wiimote4.Posy + 1/var.Wiimote4.sense2 endif //fourth sensitivity setting //xaxis if var.Wiimote4.x > var.Wiimote4.thresh3x var.Wiimote4.Posx = var.Wiimote4.Posx - 1/var.Wiimote4.sense3 endif if var.Wiimote4.x < -var.Wiimote4.thresh3x var.Wiimote4.Posx = var.Wiimote4.Posx + 1/var.Wiimote4.sense3 endif //yaxis if var.Wiimote4.z > var.Wiimote4.thresh3y var.Wiimote4.Posy = var.Wiimote4.Posy - 1/var.Wiimote4.sense3 endif if var.Wiimote4.z < -var.Wiimote4.thresh3y var.Wiimote4.Posy = var.Wiimote4.Posy + 1/var.Wiimote4.sense3 endif SendOsc(var.Wiimote4.host, var.Wiimote4.ProcessingPort, "/wii411/point", float(var.Wiimote4.Posx), float(var.Wiimote4.Posy)) debug =" x1= " + var.Wiimote.x + " y1= " + var.Wiimote.y + " z1= " + var.Wiimote.z+ "//" + " x2= " + var.Wiimote2.x + " y2= " + var.Wiimote2.y + " z2= " + var.Wiimote2.z + "//" + " x3= " + var.Wiimote3.x + " y3= " + var.Wiimote3.y + " z3= " + var.Wiimote3.z+ "//" + " x4= " + var.Wiimote4.x + " y4= " + var.Wiimote4.y + " z4= " + var.Wiimote4.z