Using the wii remote with unity

I hope its ok to share this, the original link seems to be gone.
The attached zip includes aDarwiinRemote that outputs the xyz values of the accelerometers to a textfile, which unity can read every update.

This script reads the file and changes the rotation of a gameObject every frame.

import System; 
import System.IO;

var calY = 100;
var calX = -100;
var values : Array;
var smooth = 20;


function Update () {
	var coordinates = "/wiimote.txt";
	
	if (File.Exists(coordinates)){	
		var sr = new StreamReader(coordinates); 
		var txt = sr.ReadToEnd(); 
		values = txt.ToString().Split(";"[0]);
	}

	accX = int.Parse(values[0]);
	accY = int.Parse(values[1]);
	accZ = int.Parse(values[2]);
		
	target = Quaternion.Euler (calY-accY*3, 0, 0);
	transform.rotation = Quaternion.Slerp (transform.rotation, target, Time.deltaTime*smooth);
	Debug.Log(values);
}

JarwiinRemote.zip also includes a processing script.

28932–1076–$jarwiinremote_211.zip (80.7 KB)

just bought a wii to check it out in unity :slight_smile: JOY!

oh wow, a much better way than what i was doing!

Great implementation…

This will be useful to start prototyping some ideas using the Wiimote.

I’m curious though…

What kind of file is JarwiineRemote.pde?

its for an application for creating generative/interactive art called processing ( http://www.processing.org/ )

If you google Jarwiinremote you will see that it was created for the implementation with processing.

the pde file is useless in our case and all you need is the .app :slight_smile:

Hi there,

downloaded your zip file and am confused as it seems to have nothing in it but darwiin remote which I already have, am I missing something? Really keen to start developing something with the response of the wiimote.

Thanks,

Will

you only need the darwiinremote.app, its a modified version of darwiinremote that writes the output to ./wiimote.txt

Sorry to be dumb but do I need to create that text file in that case? and should this all reside in the assets folder?

Sorry, new at this!

Also, ive been pressing the calibration buttons for “A is facing up” etc, but each time the logs says “x:16 y:16 z:16” which surely isnt right?

Also, worth mentioning im not getting a graph of whats being picked up like I do with the standard Darwiinremote (ie. not the one from here)…

Any idea why?

Okay, apologies guys, I simply hadnt deleted the profile in my bluetooth devices from when I used the original Darwiin software - ive deleted, run the modded version and it works now, sorry to rant!

does anybody know if there’s an update to jarwiinremote? it’s still based on darwinremote 0.3. i dowloaded darwinremote 0.4 and it’s much more stable.

now i would like to use this version with unity. does anybody know if there’s an update coming soon?

cheers.chris

hi all, would LOVE any help on this…

i have downloaded the original and modded darwiin remote app, but no luck. my wiimote cannot navigate or motion-sense within the fps game i’m making.

am i missing some details on preferences that i need for my wiimote?

Many thanks for any info!!
suyin

I can get regular DarwinWiimote to work just great on my mac, but when I try the modded version, the program just crashes when I connect my wiimote. I’ve made sure to delete the wiimote from the bluetooth thing in the top right.

Can anyone help me figure out whats going on?

I’m really not sure how this is supposed to work. The app is just an old version of Darwiinremote, no? Where does it output the file to? I’d like to use the nunchuck too, and this version of darwiinremote doesn’t support the nunchuck.

Is it possible to make the new version of darwiinremote save to a textfile continuously, so I could use the nunchuck?

any advice on this would be great :smile:

anyone got any tips on this?

i’m really curious as well… ! if anyone has hints on how to get the wii to integrate with unity INDIE, i’d be grateful… i’ve tried both uniWII and DarwiinRemote

thanks.

@niyus
i’ve got wiimotes to run with unity indie by use of “OSCulator” and then have written some code that parses these OSC messages sent via UDP.

As of now the wiimote works and the balance board also seems to work though i haven’t tested the balance board completely yet.

I will put it up when it’s ready. It shouldn’t take more than a week depending on how busy will be.
Otherwise push me a bit to hurry up :slight_smile:

I guess this is for wiimotes connected to PCs/MAC. What about Unity Wii wiimote control? Is there any way to access to the variables like rotation, acceleration and so on? Any idea about this?

EDIT:
Ok I found it on the script: WiiInput :slight_smile: