I have done a bit of work with Unity3D. Essentially, you'll set up Unity to act as an "external / non-ChucK synth" -- i.e., a process that listens for a stream of control parameters output by Wekinator. You'll listen on port 12000 by default, for an OSC message with the message name "/OSCSynth/params," with each control parameter attached as a float.
See http://wiki.cs.princeton.edu/index.php/ChucK/Wekinator/Instructions#Implementing_your_own_synthesis_class_outside_ChucK for the general instructions on this.
Unity-specific instructions:
I'm attaching a sample Unity scene, "Hello3.unity", that can be controlled by Wekinator. This scene has an invisible object in it, called OSCEmpty, which has a set of scripts attached to it (including Osc.cs and UDPPacketIO.cs), which are necessary for OSC to run with unity. This object also has a custom OSC script attached to it, called "OscReceiver.js." This script listens for the /OSCSynth/params message string from Wekinator, then unpacks the message and uses the 2 control parameters to change the behavior of other objects in the scene (i.e., the rotations of Cube1, Sphere1).
In order to get this example running with Wekinator, you need to tell Wekinator to use an OSC synth with 2 continuous (non-discrete) parameters. Make sure you can get the Wekinator to work with one of the "quick and easy walkthroughs" on the Wekinator wiki first, so you'll know how the software basically works. Then hook it up to unity and try creating examples (using whatever inputs/features you want to use to control Unity) with control parameter values in the range of -20 to 20 for both parameter 1 (cube rotation) and 2 (sphere rotation).
Good luck!
Rebecca
Screen.fullScreen = true;
//You can set these variables in the scene because they are public
public var RemoteIP : String = "127.0.0.1";
public var SendToPort : int = 6448;
public var ListenerPort : int = 12000;
public var controller : Transform;
private var handler : Osc;
private var sig1 : int = 0;
private var sig2 : int = 0;
public function Start ()
{
//Initializes on start up to listen for messages
//make sure this game object has both UDPPackIO and OSC script attached
var udp : UDPPacketIO = GetComponent("UDPPacketIO");
udp.init(RemoteIP, SendToPort, ListenerPort);
handler = GetComponent("Osc");
handler.init(udp);
handler.SetAddressHandler("/OSCSynth/params", Example1);
/* handler.SetAddressHandler("/1/toggle2", Example2);
handler.SetAddressHandler("/1/toggle3", Example3);
handler.SetAddressHandler("/1/toggle4", Example4);
*/
}
Debug.Log("OSC Running");
function Update () {
var go = GameObject.Find("Cube1");
go.transform.Rotate(0, sig1, 0);
var so = GameObject.Find("Sphere1");
so.transform.Rotate(sig2, sig2, 0);
var cam = GameObject.Find("cam1");
//cam.transform.Rotate(0,sig1/10,0);
}
//These functions are called when messages are received
//How to access values:
//oscMessage.Values[0], oscMessage.Values[1], etc
//Example 1
public function Example1(oscMessage : OscMessage) : void
{
Debug.Log("Called Example One > " + Osc.OscMessageToString(oscMessage));
Debug.Log("Message Values > " + oscMessage.Values[0] + " " + oscMessage.Values[1]);
sig1 = oscMessage.Values[0];
sig2 = oscMessage.Values[1];
}
// Example 2
public function Example2(oscMessage : OscMessage) : void
{
Debug.Log("Called Example Two > " + Osc.OscMessageToString(oscMessage));
Debug.Log("Message Values > " + oscMessage.Values[0]);
sig1 = - (oscMessage.Values[0]);
}
//Example 3
public function Example3(oscMessage : OscMessage) : void
{
Debug.Log("Called Example Three > " + Osc.OscMessageToString(oscMessage));
Debug.Log("Message Values > " + oscMessage.Values[0]);
sig2 = oscMessage.Values[0];
}
// Example 4
public function Example4(oscMessage : OscMessage) : void
{
Debug.Log("Called Example Four > " + Osc.OscMessageToString(oscMessage));
Debug.Log("Message Values > " + oscMessage.Values[0]);
sig2 = - (oscMessage.Values[0]);
}