OSCuMote
OSCuMote is a small example project for Unity that enables usage of Wiimotes with Unity3d indie/basic.
OSCuMote is not bound to Unity but can be used in any .NET project.
Currently it relies on Osculator at www.osculator.net which makes it mac only.
OSCuMote currently supports Multiple wiimotes, Balance board, Nunchuck, Classic Controller and Motion Plus.
Watch a video of it in action here:
The video shows two wiimotes and a balance board connected.
Version 1.0: Download here
Version 1.1 can be found: here
Version 1.2BETA: Download here
Changelog:
Version 1.2:
Vibration, LED and motion plus recalibration.
Bug corrected that prevented casting from int to float.
Version 1.1 :
Added support for Motion Plus, RAW IR, Accelerometer XYZ.
Version 1.0.
Initial version.
Note: for the people on windows,try glovepie and see if you can get it to send the right OSC messages.
Usage: (C#)
Drag the OSCuMote folder into your unity project. (Located in tuio/Assets/Sources/)
Using WiimoteReceiver:
WiimoteReceiver r;
r = WiimoteReceiver.Instance;
r.connect(8876);
if(r.wiimotes.ContainsKey(1)) // If mote 1 is connected
{
Wiimote m = r.wiimotes[1];
m.BUTTON_A;
m.MOTION_ANGLE_ROLL;
...
...
}
For a list of BUTTONS and DATA, look in Wiimote.cs
Using WiimoteTransmitter:
WiimoteTransmitter t;
t = WiimoteTransmitter.Instance;
t.setConnectionInfo("localhost", 8000);
t.connect();
// Vibration:
t.vibrate(1,1); // Vibrate mote 1
t.vibrate(1,0); // Stop vibrate mote 1
// LED's:
t.setLED(1,2); // Turn on led 2 on mote 1.
// Note there are 16 combinations total.
t.resetMotionPlus(1) // Recalibrates motion plus on mote 1.
Setting up OSCulator
To use OSCuMote with OSCulator you have to first connect your wiimote to osculator.
When this is done, you see that messages start to appear inside OSCulator when buttons are pressed and accelerometer data is received.
In order for OSCuMote to receive these messages, an OSC routing has to be made. This is shown on the image below(Blue square).
Select OSC routing as event type and select new in value.
Note that ALL data that you want to send has to be routed:
Note that when routing pry and the likes, only e.g. pry has to be forwarded and not the individual values inside pry. When forwarding the top level, all values in pry are forwarded.
When new is selected, a dropdown appears (Image below) where you can specify which port to forward to (Purple squre). This port has to be the port that you chose in OSCuMote.
To use vibration and LED with OSCulator, you have to set up OSCuMote to send messages to the same port as specified in the (red square) in the first picture above.
First time a vibration message is sent from Unity (e.g. t.vibrate(1,1)
), it will appear inside OSCulator.
This is shown in the (green box) in picture one. Set the event to vibrate and what wiimote that should vibrate. e.g. message /wii/1/vibrate should vibrate Wiimote1 and so on. Same goes for LED flashing.
A sample OSCulator file is provided as of version 1.2
Notes:
The WiimoteReciever class is implemented using the singleton pattern.
This means that there can only exist one instance of this class at any time.
How you use/scale the data is your headache :)
OSCulator (Mac):
Using osculator is described at OSCulator.net
However i have provided a sample setup that shows one wiimote connected and how it forwards all messages to a specific local port.
GlovePIE (Windows):
A glove pie script is on the way for sending OSC data to C#. Unfortunately the developer of GlovePIE broke OSC support in newer versions and makes Motion Plus support not available.
NOTE: While the code provided is made for wiimotes. It can be extended to support all input devices that OSCulator or GlovePIE can handle. Either write your own parsing or forward the values into the wiimote data objects.
I would personally go for the former.
In the future, a more generic version might be written that makes it more pluggable for other devices.
For people with interest in multi touch tables. Search the web for TUIO or look at nuigroup.com.
Some of the multi touch software sends the finger touches over the OSC protocol and hence can be sent to Unity.
There should be some code on the unity forums for multi touch tables in particular.
CORRECTION: Some sample code is included in the OSCuMote code that uses multi touch blobs. For usage of the TUIO library google TUIO for C#. The library also supports feducials...
Temporary website:
http://www.itu.dk/people/jzso/
Primary domain: (Down at the moment)
http://www.sketchground.dk
About:
OSCuMote is developed by Jens Zeilund and is free to use for whatever purposes that might suit you.
My primary home is www.sketchground.dk, however i am currently without a hosting company.
One way of contacting me is through the unity forums: user sketchground.