Search Unity

Wiimote Plugin

Discussion in 'Made With Unity' started by bliprob, Oct 19, 2007.

  1. james1507

    james1507

    Joined:
    Feb 8, 2010
    Posts:
    2
    Hi People

    Iv been trying to get to grips with the plugin and have downloaded the source files for the fps tutorial that has been modified to work with the wii remote. Unfortunately it doesn't appear to work as i have a newer version of unity. Is there an up to date version that will work for me??? Please help
     
  2. sacredgeometry

    sacredgeometry

    Joined:
    Dec 5, 2009
    Posts:
    55
    ive been using osculator to get wii control (it support full control with wiimotplus and chucks) but it would be a nice thing to be able to use inside of unity.

    any updated news on this script. fps would be awesome with the wii remote.
     
  3. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    I've managed to create a VJing application that uses UniWii. I'm using it in live production, with mixed results.

    First of all, when it works, it works well. And I'm excited that this plug-in makes grabbing input from the Wii remote so easy. Thank you to all involved. :)

    However, when testing in the editor, every once in a while when I press 12 to connect, I get an OS X kernel panic. For those unaware, this is basically a more aesthetically pleasing blue-screen-of-death. I've never seen it happen in the standalone application yet, but obviously I'm afraid it will, and that would be a catastrophe during a live production. Has anyone else experienced kernel panics when connecting the remote?

    Next, sometimes the Wii remote just doesn't connect. I have to proverbially jiggle the handle by turning off bluetooth and quitting and relaunching my app to reconnect, sometimes multiple times. Is there a way to help reduce this problem? Any tips? This is annoying, but manageable if I can just leave my application up for a long time. However, I fear that this will become a big problem if the remote goes outside the Bluetooth range, drops the connection for some unforeseen reason, or especially when connecting multiple remotes (which I plan on doing).

    My conclusion is that my current setup isn't really ready for full production quite yet. Is there something I can do to help these issues?
     
  4. ElmarKleijn

    ElmarKleijn

    Joined:
    May 11, 2009
    Posts:
    87
    I've been experiencing the same problem for quite a while as well. At work we have two Wiimotes. Sometimes I just can't get one to work, and need to use the other. Quite strange. One time I did not get the wiimotes to connect all, during a large business convention. I think the large amount of Bluetooth devices just made it impossible to connect. It has been the only plausible explanation thus far. something you might want to know as well ;).

    But, it seems to be rather difficult for manufacturers to create good, proper working Bluetooth stacks. All stacks have their own problems. Right now we use the small $2 bluetooth 'stick' from DealExtreme in combination with the BlueSoleil driver.

    I've noticed that I have to:

    - Start bluesoleil, refresh devices, refresh services of wiimote when found;
    - Start our 'Wii game';
    - Start hitting the buttons and connect
    - Now it _might_ work.

    It has been always essential to have the game running while trying to connect!
     
  5. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    I was demoing this to a friend and got a kernel panic starting the standalone application, too. So it's not just in the editor.

    Anyone else getting kernel panics, too?
     
  6. Michele

    Michele

    Joined:
    Apr 28, 2008
    Posts:
    73
    Hi, nothing about the wii balanceboard support? :roll:
     
  7. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    I don't quite have a feel for the cause of the kernel panics, but it could possibly have to do with bringing the computer from sleep and then running an application later?

    With regards to connecting remotes, I tried just booting my computer, launching an app, and trying to connect a remote, but even that does not work the first try sometimes. Not sure if there's a specific order that provides more reliable connectivity yet.

    Anyone have any other tips? I'll look into 3rd party bluetooth solutions.
     
  8. cnribbens

    cnribbens

    Joined:
    Apr 7, 2010
    Posts:
    1
    I've tried the demo/test scene and i've got a little problem and I was wondering if other people has the same problem. With the IR pointer it only counts for the lower half of the screen. When I go higher than half of the screen the x and y go to -100 and the counter disappears. is this normal? Or must i tweak the code to fit the screen?
     
  9. mgaldieri

    mgaldieri

    Joined:
    Dec 8, 2008
    Posts:
    10
    Hi! I was using the UniWii plugin and everytihng was working fine until I updated my system to 10.6.3 (was using 10.6.2). Suddenly my game stopped recognizing the wiimote. Actually it connects to it but looses the connection shortly after. Should the bundle be recompiled against the updated version of SL? Thanks!
     
  10. mgaldieri

    mgaldieri

    Joined:
    Dec 8, 2008
    Posts:
    10
    Anyone successfully used this one on Snow Leopard 10.6.3? My game stopped recognizing the wiimote after upgrading from 10.6.2.
     
  11. ibmeruu

    ibmeruu

    Joined:
    Apr 21, 2010
    Posts:
    18
    Offering a six pack for code.

    I would like to move 4 objects in unity pro.

    The trick is I want to do this with the Wiimote IR.

    The Wiimote is in a fixed position looking at a wall and 4 IR sources (laser pens or LED's) are moved on the wall.

    In the Game the 4 objects move with the laser pens.

    I know a six pack is cheap and I would offer more if I could. Please help, and beer will be on the way.
    (must be 21yrs old)

    http://www.beeronthewall.com/gift-baskets/c-bob-6pk.html
     
  12. basel

    basel

    Joined:
    Nov 16, 2009
    Posts:
    33
    How do you connect your wii mote with the computer?
     
  13. ibmeruu

    ibmeruu

    Joined:
    Apr 21, 2010
    Posts:
    18
    http://www.unifycommunity.com/wiki/index.php?title=UniWii



    using UnityEngine;
    using System;
    using System.Collections;
    using System.Runtime.InteropServices;

    public class WiiMote : MonoBehaviour {

    [DllImport ("UniWii")]
    private static extern void wiimote_start();

    [DllImport ("UniWii")]
    private static extern void wiimote_stop();

    [DllImport ("UniWii")]
    private static extern int wiimote_count();

    [DllImport ("UniWii")]
    private static extern byte wiimote_getAccX(int which);
    [DllImport ("UniWii")]
    private static extern byte wiimote_getAccY(int which);
    [DllImport ("UniWii")]
    private static extern byte wiimote_getAccZ(int which);

    [DllImport ("UniWii")]
    private static extern float wiimote_getIrX(int which);
    [DllImport ("UniWii")]
    private static extern float wiimote_getIrY(int which);
    [DllImport ("UniWii")]
    private static extern float wiimote_getRoll(int which);
    [DllImport ("UniWii")]
    private static extern float wiimote_getPitch(int which);
    [DllImport ("UniWii")]
    private static extern float wiimote_getYaw(int which);

    private string display;
    private int cursor_x, cursor_y;
    private Texture2D cursor_tex;
    private Vector3 oldVec;

    // Use this for initialization
    void Start () {
    wiimote_start();
    cursor_tex = (Texture2D) Resources.Load("crosshair");
    }

    // Update is called once per frame
    void FixedUpdate () {
    int c = wiimote_count();
    if (c>0) {
    display = "";
    for (int i=0; i<=c-1; i++) {
    int x = wiimote_getAccX(i);
    int y = wiimote_getAccY(i);
    int z = wiimote_getAccZ(i);
    float roll = Mathf.Round(wiimote_getRoll(i));
    float p = Mathf.Round(wiimote_getPitch(i));
    float yaw = Mathf.Round(wiimote_getYaw(i));
    float ir_x = wiimote_getIrX(i);
    float ir_y = wiimote_getIrY(i);
    display += "Wiimote " + i + " accX: " + x + " accY: " + y + " accZ: " + z + " roll: " + roll + " pitch: " + p + " yaw: " + yaw + " IR X: " + ir_x + " IR Y: " + ir_y + "\n";
    if (!float.IsNaN(roll) !float.IsNaN(p) (i==c-1)) {
    Vector3 vec = new Vector3(p, 0 , -1 * roll);
    vec = Vector3.Lerp(oldVec, vec, Time.deltaTime * 5);
    oldVec = vec;
    GameObject.Find("wiiparent").transform.eulerAngles = vec;
    }
    if ( (i==c-1) (ir_x != -100) (ir_y != -100) ) {
    //float temp_x = ((ir_x + (float) 1.0)/ (float)2.0) * (float) Screen.width;
    //float temp_y = (float) Screen.height - (((ir_y + (float) 1.0)/ (float)2.0) * (float) Screen.height);
    float temp_x = ( Screen.width / 2) + ir_x * (float) Screen.width / (float)2.0;
    float temp_y = Screen.height - (ir_y * (float) Screen.height / (float)2.0);
    cursor_x = Mathf.RoundToInt(temp_x);
    cursor_y = Mathf.RoundToInt(temp_y);
    }
    }
    }
    else display = "Press the '1' and '2' buttons on your Wii Remote.";
    }

    void OnApplicationQuit() {
    wiimote_stop();
    }

    void OnGUI() {
    GUI.Label( new Rect(10,10, 500, 100), display);
    if ((cursor_x != 0) || (cursor_y != 0)) GUI.Box ( new Rect (cursor_x, cursor_y, 50, 50), cursor_tex); //"Pointing\nHere");
    int c = wiimote_count();
    for (int i=0; i<=c-1; i++) {
    float ir_x = wiimote_getIrX(i);
    float ir_y = wiimote_getIrY(i);
    if ( (ir_x != -100) (ir_y != -100) ) {
    float temp_x = ((ir_x + (float) 1.0)/ (float)2.0) * (float) Screen.width;
    float temp_y = (float) Screen.height - (((ir_y + (float) 1.0)/ (float)2.0) * (float) Screen.height);
    temp_x = Mathf.RoundToInt(temp_x);
    temp_y = Mathf.RoundToInt(temp_y);
    //if ((cursor_x != 0) || (cursor_y != 0))
    GUI.Box ( new Rect (temp_x, temp_y, 64, 64), "Pointer " + i);
    }
    }
    }
    }
     
  14. bobpitbull

    bobpitbull

    Joined:
    Jun 14, 2010
    Posts:
    6
    Hi,

    Can I ask about the Wiimote and Sensor Bar on PC...? I'm just wondering how easy they are to setup, is any hardware modding required?

    Bob
     
  15. ibmeruu

    ibmeruu

    Joined:
    Apr 21, 2010
    Posts:
    18
    I found the best way for me was to use OSC to link the wiimote. It was easyer to code and let me get all the wiimote raw IR data.

    Search the forum for Wiimote OSC to find the sample project.

    Good Luck.
     
  16. God-at-play

    God-at-play

    Joined:
    Nov 3, 2006
    Posts:
    330
    Same here. The plug-in is great because everything is wrapped up in the exe, but it causes infrequent and seemingly random kernel panics (Mac version of BSoD), and sometimes it simply doesn't connect the remotes.

    I couldn't find a solution, so I switched to OSCuMote and it seems to be a lot more consistent. No crashing, either.
     
  17. shmeck

    shmeck

    Joined:
    Apr 19, 2008
    Posts:
    25
  18. Uonze

    Uonze

    Joined:
    Jun 18, 2010
    Posts:
    10
    I'm trying to develop a demonstration using Unity 3.0 with the wiimote, i found this plugin but i can find the download for windows.

    Please help
     
  19. Joe ByDesign

    Joe ByDesign

    Joined:
    Oct 13, 2005
    Posts:
    841
  20. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,997
    So can I use this? (3.1 free not pro PC)
     
  21. kumoishibo

    kumoishibo

    Joined:
    Jan 28, 2011
    Posts:
    1
    Hello everyone. Long time lurker first time poster.
    I've been through this post (and many others) and several times, trying to look for an option for using wiimote as a gun controller. In order to have the wiimote's aim be properly calibrated one would require 4 IR points to compensate for screen keystone skew if you happen to not be directly in front of screen.

    Would it be possible to retrieve these raw IR points instead of grabbing an averaged single point position grabbed by wiimote_getIrY(int which) wiimote_getIrX(int which).

    I work on a windows machine and honestly would like to avoid using OSCumote or GlovePIE.
     
  22. Jake12456

    Jake12456

    Joined:
    Feb 14, 2011
    Posts:
    11
    Hey, I am trying to connect 4 wiimotes through uniwii. Its very odd because I can connect 3 in one game, but it caps at 3. Then while the former game is running I run another instance and it connects 1. It seems uniwii has a cap of 3. Is this true and has anyone found a work around yet?
     
  23. alejandro

    alejandro

    Joined:
    Jul 7, 2009
    Posts:
    7
    Why the wiimote_getYaw() function always return 0 ????
     
  24. alejandro

    alejandro

    Joined:
    Jul 7, 2009
    Posts:
    7
    The yaw values are always 0 . This is normal or is just me ?
     
  25. Rastafari

    Rastafari

    Joined:
    Jul 18, 2011
    Posts:
    196
  26. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Working on museum exhibit project using Wiimote / gestural inputs. I'd rather use custom Wiimote-clone hardware with power and data flowing through a tether. (We need the tether anyways for security, and wiring the data connection would avoid all the issues with a reliable bluetooth connection.) Does anyone know a fabricator for this kind of thing?
     
  27. bourriquet42

    bourriquet42

    Joined:
    Mar 12, 2012
    Posts:
    1
    Hi everybody,

    I read in this thread that the raw IR points can now be accessed with UniWii plugin.
    But i didn't read anywhere what functions I should use for that...
    Does anybody know?

    Thanks
     
  28. jonesvg

    jonesvg

    Joined:
    Jul 29, 2010
    Posts:
    27
    Hey friends, i have this error message, i'm trying build in windows 7 to generate a .exe

    ArgumentException: The Assembly Microsoft.VisualC is referenced by UniWii. But the dll is not allowed to be included or could not be found.
    UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/AssemblyHelper.cs:52)
    UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/AssemblyHelper.cs:87)
    UnityEditor.HostView:OnGUI()

    Someone have any idea about this message?
     
  29. jonesvg

    jonesvg

    Joined:
    Jul 29, 2010
    Posts:
    27
    Success in building the source, but i don't connect wiimotes in windows, happens in Mac and i need to connect it, someone have any success in connect with uniWii in windows?
     
  30. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    Yeah, seems to cap at three. I'm having the same issue and haven't found a workaround.
     
  31. nofosu1

    nofosu1

    Joined:
    Jan 13, 2011
    Posts:
    73
    I would love to see how this develops. I've always dreamed about making my own wii game.
     
  32. sennin31

    sennin31

    Joined:
    Oct 17, 2012
    Posts:
    8
    HI all,

    Is this plugin works on IOS?

    Thanks,
    Sennin.
     
  33. silverduck

    silverduck

    Joined:
    May 16, 2010
    Posts:
    27
    Hello everyone! After months of lurking on this thread and others like it, I have managed to create my own alternative to UniWii that provides raw IR data, as well as other features like Motion Plus, classic controller, guitar hero guitar, guitar hero drum set, the DJ Hero turntable, and the balance board.

    I did my best to make it as easy to use as possible. You can find the API of all its functions here.

    I recently put it up for sale on the Asset Store. Hopefully, if it sells well enough, I'll be able to start making some actual Wii U games. :D

    Please let me know what you think and if there's anything I can do to further improve it. I'm still working on the Windows version (currently it's Mac only) and I'll be getting to work on the Wii-U controllers as soon as I can get my hands on them.

    -Greg
     
  34. theattic

    theattic

    Joined:
    Nov 23, 2012
    Posts:
    1
    Woah, nice work Silverduck!! WiiBuddy might be the answer!

    I too have been lurking on here trying to figure out how to make Head Tracking work with BlipRob's UniWii code to no avail on Mac or PC.

    Have you tried to do it before? Had any success?

    Is anyone willing to share a successful build?
     
  35. snyamathi

    snyamathi

    Joined:
    May 4, 2013
    Posts:
    1
    Been a while since this thread was updated..

    Any news on getting the raw IR data via UniWii for Windows? I've tried WiiBuddy and it works well for OSx but I need a windows solution before they're going to be able to release the Windows version of WiiBuddy.
     
  36. zalo10

    zalo10

    Joined:
    Dec 5, 2012
    Posts:
    21
    I'd like to know too. It seems that it only spits out the average of the tracked blobs.
     
  37. alex4unity

    alex4unity

    Joined:
    Apr 28, 2013
    Posts:
    27
    hey, could solve some problems but still have that one issue that I get the message "No Remote detected..." when I start a x86 build... In Unity the demo is working fine but not in the build. Anyone ideas?
     
    Last edited: Sep 25, 2013
  38. tanzkolloss

    tanzkolloss

    Joined:
    Jan 5, 2015
    Posts:
    1
    hey everybody
    can anyone reupload the windows version? the links above aren't availible.
    Thx
     
  39. Staur

    Staur

    Joined:
    Feb 6, 2015
    Posts:
    8
  40. arckex

    arckex

    Joined:
    Nov 17, 2013
    Posts:
    3
    brilliant. thanks staur
     
  41. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44
    Hey guys, if only this worked on iOS ! ! ! ! !

    IPete2