(Not on the XP side, neither on the OS side)
(Never buy a MacBook: the double boot is ok, but all kind of problems with 3D programs, like Second Life BLENDER, and now also wiiflash, the Xcode is ok though, nice making a game for the Iphone, see other blogs)
Working on the XP side:
BlueSoleil only caused other problems.
So i relied on the simple bluetooth window provided by XP for connecting the wii remote.
Then i remembered the FLOSC, i searched the internet and found some vague references to this alternative to the wiiflash server.
After a bit of experimenting i found out what to combine and how:
1. Connect the wiiremote
2. start up GlovePie with this script (example script to connect and read a few values, change to what you need)
OSC.port = 5000 // referring to OSC port in FLOSC ... OSC can be changed, it is just a variable name
OSC.ip = "localhost"
OSC.broadcast = true
OSC.wii.x = Wiimote.gx
OSC.wii.y = Wiimote.gy
OSC.wii.z = Wiimote.gx

OSC.roll = RemoveUnits(Wiimote.Roll)
OSC.pitch = RemoveUnits(Wiimote.Pitch)
3. start FLOSC:
portnumbers from GLOVEPIE and FLASH

4. example script in FLASH with a XMLsocket connection reading the XML input coming from FLOSC:
import flash.events.*;
import flash.net.XMLSocket;
var hostName:String = "127.0.0.1";
var port:uint = 1250; // referring to flash port in FLOSC
var socket:XMLSocket;
socket = new XMLSocket();
socket.connect(hostName, port);
socket.addEventListener(DataEvent.DATA, dataHandler);
function dataHandler(event:DataEvent):void {
var xmlData = new XML();
xmlData.ignoreWhite=true;
xmlData = XML(event.data);
/* comment example
ADDRESS = attribute
MESSAGE = descendant
incoming: (picture, because XML data are not visible on this page :-)

gives: (with trace line below)
/wii/x
f -3.9451861
*/
trace( xmlData.descendants("MESSAGE").attribute("NAME") );
trace( xmlData.descendants("ARGUMENT").attribute("TYPE") + " " + xmlData.descendants("ARGUMENT").attribute("VALUE") );
}
6. make use of the data in fancy flash application!
for instance: asking for the x value:
if ( String(xmlData.descendants("MESSAGE").attribute("NAME")) == "/wii/x")
giveNumberX.text =String(xmlData.descendants("ARGUMENT").attribute("VALUE"));
putting the value in the field
Have fun!
0 comments:
Post a Comment