FreePIE Wiimote iR plugin

Official forum for open source FreePIE discussion and development.
Post Reply
RAJ-rios
One Eyed Hopeful
Posts: 3
Joined: Mon Sep 30, 2019 3:16 am

FreePIE Wiimote iR plugin

Post by RAJ-rios »

Hi everybody,
I've been lurking for a long time (since the article came out around 2010 about EDID overriding the first generation passive 3D TVs for NVidia support :3D :polarized ) but have finally made an account to join in the discussion. I can see the enthusiasm for DIY and budget VR is still going strong here, so I thought I'd say a little about what I'm working on, and also seek some help. TL;DR at the end.

I, as well as many others, are working on unifying input systems to deliver the best VR experience depending on what hardware is available. I'm sure you all know about PSMove on PC, or RiftCat for cell phones. I'm trying to take things a step farther using things that may be laying around the house or obtained cheaply, such as Wii-remotes or Kinect or Windows/Android phones.

The current stumbling block is using wiimotes for 3-DOF. It's common knowledge that the Wii tracked pitch and roll, perusing years of forum posts makes it apparent that not many know about the "motion plus" addition a few years after the Wii's release that added a gyro to track yaw as well. Eventually Nintendo started selling their wiimotes with motion plus built in, which was a headache for early developers because of the different bluetooth protocols they used- this is no longer an issue with Windows 10's bluetooth stack (or a MayFlash Dolphinbar, which I'll get to).

FreePIE has native support for MotionPlus, but it doesn't have support for the iR camera in the wiimote which can fix 'yaw-drift' when a 'sensor-bar' is present. Glovepie, on the other hand, had sensor-bar support but didn't support the wiimotes with built in motion plus (called -TR due to the updated model name) and has long since been discontinued. The Dolphinbar mentioned above is a bluetooth adapter and iR light source for all versions of wiimotes.

Using a Dolphinbar and -TR wiimotes in my development and playing environments, I am receiving very good data from the wiimote into Freepie. Once calibrated (sometimes 2 or 3 times for the best initial calibration) the values are very stable, and the yaw tracks remarkably well for only having itself as a reference point. I mean it's really truly impressive, you could use it as a mouse for internet browsing with no trouble. Until you start hacking away at an enemy or a box in Beat Saber, then even with perfect calibration you'll be spinning on the yaw axis faster than the wiimote can register, and wind up with your controller and cursor in different directions.

Now the good news for many is that the motion plus add-on module is functionally identical to the wiimotes with it built in, aside adding unnecessary bulk and weight to the controller. The downside is that GlovePIE is dead, and while you may be able to script something together that works today, it may not tomorrow or ever again and we will focus on a platform that includes support for the most modern hardware (-TR) and software (FreePIE) to make VR accessible to all.

Now comes the call for aid. There are so many Wii remote libraries available, but plugin development is outside the experience range that my wife and I have (she's a developer for a very large corporation, I've been homebrewing tech for ~20 years). We looked into it over the weekend and we think we're going to need some outside help. Having a Dolphinbar is great for having a known-good bluetooth adapter and a sensor-bar for the current retail price of $19.93 USD via Amazon, but the plugin will not depend on having one; once synced to the PC we only need to get the iR camera to track an infrared light source and allow a button press to reorient to e.g. 0/180, in case you're playing aimed away from the sensor-bar.


Now for those wondering how they can use this without compromising their current setups, this should be fully compatible with whatever you're already using, GearVR, Trinus, VRidge Riftcat, OSVR, ALVR, Driver4VR, Kinect2VR to name a few, even actual Vive users who have broken one remote and want to use a wiimote. I'm not suggesting you invest heavily into this if you already have or can cheaply purchase a PSMove setup, but this has more mappable buttons and should provide more accuracy than the magnetometer in PSMove so if you have the hardware collecting dust, this may provide a superior experience.

TL;DR:
We need help making a FreePIE plugin that will allow wiimotes to utilize their built-in infrared cameras. With 3DOF perfected, a Kinect or PSMove camera will make them 6DOF controllers for a sliver of the cost of Vive/Index controllers.
MKCline
One Eyed Hopeful
Posts: 1
Joined: Sat Jan 18, 2020 7:39 pm

Re: FreePIE Wiimote iR plugin

Post by MKCline »

Looking at the way this works, FreePIE relies on the Dolphiimote DLL (https://github.com/maxmalmgren/DolphiiMote) to collect all of the Wiimote data.
If you look at https://github.com/maxmalmgren/DolphiiM ... zation.cpp you will notice that line 234, the retrieve_infrared_camera_data method is not implemented. So I think the first step would be to extend this code, and then incorporating into FreePIE would just be wrapping like all of the other data.

Looking at the descriptions https://wiibrew.org/wiki/Wiimote, it explains the way to add this into the reporting to enable the IR camera and then the data that comes back. They say it has a field of view of ~33* Horizontally and ~23* vertically, and then it tracks to the sensor bar in that there are 2 IR clusters at each end of the bar and it can track 4 objects (I assume 2 left and 2 right).

Apart from all of the other technical information that isn't clear to me, it seems that it looks to track 4 objects and when 1 goes out of view, that slot goes empty, but if you then were to pick up another, how would you know when an object 'jumped tracking slots'? In my simple, mind, it seems like you'd need/want IR clusters across your wall so that you'd have like 5 across always picking up 2 of them. I guess you'd need the same, but more vertically with the smaller angle.
tonytony
One Eyed Hopeful
Posts: 6
Joined: Tue Feb 06, 2024 10:10 pm

Re: FreePIE Wiimote iR plugin

Post by tonytony »

Thank you for the information. I'm just gonna do simpler stuff and try to finetune my scripts which is coming along well. But from the thread I've just now realized that the Wiimote TR might not be compatible with GlovePIE? I currently use a a motion plus extension but because of the wiimote port being in bad condition it fails often and the nunchuck also glitches out, I have to unplug and plug the motion plus again severall times before any response, but its funny that even if the motion plus doesn't work, it allows me to plug in the nunchuck without it glitching out. Anyways, I ordered a wiimote with built in motion plus, now I'm worried it's not gonna work because it might not be compatible with glovepie. I'll use it for my wii of course but I want to get it to work, so if I really can't I'll try freepie. But Is it really not compatible, I went to the GitHub and there's a glovepie exe that's supposedly a test for TR, Could it be used? : https://github.com/GlovePIEPreservation ... PlusTR.zip.
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

I had a post before, I want to dig deeper into motion plus, because of my wii mote with in-built wii motion plus inside. I havent been able to run anything on freepie. Trying to write a simple script down. There is the hardware+software issues.

I just want to simple press A on wii mote and translates it into a keyboard press A.

Give me any simple script so I had at least some clue or a sync script.
tonytony
One Eyed Hopeful
Posts: 6
Joined: Tue Feb 06, 2024 10:10 pm

Re: FreePIE Wiimote iR plugin

Post by tonytony »

Hi Hanabara. I have that same issue and am intimidated by freepie and my computer is not very good so even though it crashes some times, glovepie is very light in terms of resources and is easy to write code in my opinion. My wiimote is hanging in there but I ordered a wiimote with motionplus built-in as well, but I'm new to this and have no idea if it's going to be comptible since I don't have it yet, so I'm also interested in the results you get. If your wiimote is 3rd party I think that's why it doesn't work but I think if it is, it's still worth a shot.
BTW what is the wiimote's name that appears on your computer.

You should download GlovePIE 0.46, and try that executable and the scripts that come with: https://github.com/GlovePIEPreservation ... vePIE-0.46

I advise trying to connect in devices and printers first, I don't actually know if it works with the tr model but if that doesn't work use Dolphin.
Then try writting this in glovepie, run it and then open a notepad to see if it writes, and also check the variables tab:

Code: Select all

Keyboard.A=Wiimote.A
Keyboard.B=Wiimote.B
var.exists=Wiimote.Exists
if glovepie finds the wiimote, var.exists is TRUE, that's the only thing you need to check.

I assume that if that version doesn't work you have to try using this version: https://github.com/GlovePIEPreservation ... PlusTR.zip

if it really doesn't work I really don't know how to help. But as a last effort. If the model name is different than "Nintendo RVL-CNT-01" try changing to it, though I doubt it's going to work.

if it works you can try watching this even though it's a tutorial on an older version of glovepie, but the newer version is even more simple: https://www.youtube.com/watch?v=rii4CYX ... C01DB243F5 . Also read the word document that comes with glovepie0.46

Please let me know if it works. If so you can ask me for any type of script because I've been figuring it out for a while and I think it's fun.

If you're are trying to emulate a ps1 controller I think the only virtual joystick glovepie can output to is ppjoy which I think can do what you want, you can find how to in the tutorial. I'm not really sure if it can use other virtual joysticks.
You said you're trying to emulate swing motion and I take it as emulating the analog stick as you swing around, but if you mean detecting certain motions as a button input that can be done with or without motion plus.
If you're trying to make wii motion plus into analog stick I think it's way harder since you'll have to regularly set the wiimote on the table to calibrate the Motion Plus because drift happens quickly if you swing around too fast, but if you're slow I think it might last a lot longer. You should check my other post (viewtopic.php?t=29309).

The best solution in my opnion you can use gravity itself and just tilt the wiimote so it never drifts(you could do this with no wiimotionplus and you could even use the nunchuck if you want). Glovepie has Wiimote.SmoothPitch which gives a value of -90 to 90(pointing up or down) and Wiimote.SmoothRoll which gives -180 to 180( value 0 when wiimote is facing up). It comes with its own problems like if you're pointing straight up or down the roll gets really sensitive but you can basically just have the pitch values from -45 to 45(or try increasing the angle a little and testing) mapped to the analog values for up and down and have roll -90 to 90 mapped to left and right. But this way makes you have to play very stiff because the wiimote has to be perpendicular to the ground and facing up completely to have no inputs.That's why I think you can use Delta(Wiimote.Smoothpitch) to get the variation in the angle instead and add to the analog values overtime but only when pressing a button, then reset to no input when not pressing. I already have a script with this concept for the mouse cursor, so for example, if you want to go up you press the B button and then tilt up.
if you have questions ask, and also I could try helping you out with a script.

if you really want to use motion plus and don't care about the drift you would basically do the same thing with Wiimote.Yaw and Wiimote.Pitch(these are the motion plus values which tend to drift) and make sure the wiimote faces forward when setting on a table. In a similar way you can get the angle variation values directly in (Wiimote.YawSpeed and Wiimote.PitchSpeed). I recommend checking out lednerg's script from the wiimote scripts that come with glovepie0.46, it allows the wiimote to be facing any direction(except for straight up or down) and do the accurate input, for example, in a simple script if you have the wiimote sideways and tilt up, the Yaw value is the one that changes so the input would be to the right instead of up, in lednerg script it does the correct input.
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

tonytony wrote: Sun Feb 11, 2024 4:21 pm Hi Hanabara. I have that same issue and am intimidated by freepie and my computer is not very good so even though it crashes some times, glovepie is very light in terms of resources and is easy to write code in my opinion. My wiimote is hanging in there but I ordered a wiimote with motionplus built-in as well, but I'm new to this and have no idea if it's going to be comptible since I don't have it yet, so I'm also interested in the results you get. If your wiimote is 3rd party I think that's why it doesn't work but I think if it is, it's still worth a shot.
BTW what is the wiimote's name that appears on your computer.

You should download GlovePIE 0.46, and try that executable and the scripts that come with: https://github.com/GlovePIEPreservation ... vePIE-0.46

I advise trying to connect in devices and printers first, I don't actually know if it works with the tr model but if that doesn't work use Dolphin.
Then try writting this in glovepie, run it and then open a notepad to see if it writes, and also check the variables tab:

Code: Select all

Keyboard.A=Wiimote.A
Keyboard.B=Wiimote.B
var.exists=Wiimote.Exists
if glovepie finds the wiimote, var.exists is TRUE, that's the only thing you need to check.

I assume that if that version doesn't work you have to try using this version: https://github.com/GlovePIEPreservation ... PlusTR.zip

if it really doesn't work I really don't know how to help. But as a last effort. If the model name is different than "Nintendo RVL-CNT-01" try changing to it, though I doubt it's going to work.

if it works you can try watching this even though it's a tutorial on an older version of glovepie, but the newer version is even more simple: https://www.youtube.com/watch?v=rii4CYX ... C01DB243F5 . Also read the word document that comes with glovepie0.46

Please let me know if it works. If so you can ask me for any type of script because I've been figuring it out for a while and I think it's fun.

If you're are trying to emulate a ps1 controller I think the only virtual joystick glovepie can output to is ppjoy which I think can do what you want, you can find how to in the tutorial. I'm not really sure if it can use other virtual joysticks.
You said you're trying to emulate swing motion and I take it as emulating the analog stick as you swing around, but if you mean detecting certain motions as a button input that can be done with or without motion plus.
If you're trying to make wii motion plus into analog stick I think it's way harder since you'll have to regularly set the wiimote on the table to calibrate the Motion Plus because drift happens quickly if you swing around too fast, but if you're slow I think it might last a lot longer. You should check my other post (viewtopic.php?t=29309).

The best solution in my opnion you can use gravity itself and just tilt the wiimote so it never drifts(you could do this with no wiimotionplus and you could even use the nunchuck if you want). Glovepie has Wiimote.SmoothPitch which gives a value of -90 to 90(pointing up or down) and Wiimote.SmoothRoll which gives -180 to 180( value 0 when wiimote is facing up). It comes with its own problems like if you're pointing straight up or down the roll gets really sensitive but you can basically just have the pitch values from -45 to 45(or try increasing the angle a little and testing) mapped to the analog values for up and down and have roll -90 to 90 mapped to left and right. But this way makes you have to play very stiff because the wiimote has to be perpendicular to the ground and facing up completely to have no inputs.That's why I think you can use Delta(Wiimote.Smoothpitch) to get the variation in the angle instead and add to the analog values overtime but only when pressing a button, then reset to no input when not pressing. I already have a script with this concept for the mouse cursor, so for example, if you want to go up you press the B button and then tilt up.
if you have questions ask, and also I could try helping you out with a script.

if you really want to use motion plus and don't care about the drift you would basically do the same thing with Wiimote.Yaw and Wiimote.Pitch(these are the motion plus values which tend to drift) and make sure the wiimote faces forward when setting on a table. In a similar way you can get the angle variation values directly in (Wiimote.YawSpeed and Wiimote.PitchSpeed). I recommend checking out lednerg's script from the wiimote scripts that come with glovepie0.46, it allows the wiimote to be facing any direction(except for straight up or down) and do the accurate input, for example, in a simple script if you have the wiimote sideways and tilt up, the Yaw value is the one that changes so the input would be to the right instead of up, in lednerg script it does the correct input.

UPDATE

1. Thanks a lot you manage to help me to be able to use wii motion plus inside controller into Glovepie, it works with version 0.46 at least. At least it is running smoothly, perhaps it shut down when not in usage, going to check it out.
So for people being new like me with wii mote connection:

1. Open control panel, show bigger Icon on the top right for windows 11, open a new window for "Device and Printers" , Find the device and click next for connecting to wii mote.
2. Go to dolphin latest emulator, go to the controller scheme, set to real wii mote in bluetooth adapter, continous scanning and hold sync button on wii mote. It will vibrate so you become player 1.
3. Get GlovePie 0.46, doesnt work with other. Put the simple script first to check the condition and then run.

2. going to check out ppjoy,xpadder and all available options

3. yea going to test out the lednergs script and with the help of chatgpt i may get the optimal solution, unless the software is too outdated. Then I need help with Freepie early implementation from you :)
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

hanabara wrote: Tue Feb 13, 2024 9:20 am
tonytony wrote: Sun Feb 11, 2024 4:21 pm Hi Hanabara. I have that same issue and am intimidated by freepie and my computer is not very good so even though it crashes some times, glovepie is very light in terms of resources and is easy to write code in my opinion. My wiimote is hanging in there but I ordered a wiimote with motionplus built-in as well, but I'm new to this and have no idea if it's going to be comptible since I don't have it yet, so I'm also interested in the results you get. If your wiimote is 3rd party I think that's why it doesn't work but I think if it is, it's still worth a shot.
BTW what is the wiimote's name that appears on your computer.

You should download GlovePIE 0.46, and try that executable and the scripts that come with: https://github.com/GlovePIEPreservation ... vePIE-0.46

I advise trying to connect in devices and printers first, I don't actually know if it works with the tr model but if that doesn't work use Dolphin.
Then try writting this in glovepie, run it and then open a notepad to see if it writes, and also check the variables tab:

Code: Select all

Keyboard.A=Wiimote.A
Keyboard.B=Wiimote.B
var.exists=Wiimote.Exists
if glovepie finds the wiimote, var.exists is TRUE, that's the only thing you need to check.

I assume that if that version doesn't work you have to try using this version: https://github.com/GlovePIEPreservation ... PlusTR.zip

if it really doesn't work I really don't know how to help. But as a last effort. If the model name is different than "Nintendo RVL-CNT-01" try changing to it, though I doubt it's going to work.

if it works you can try watching this even though it's a tutorial on an older version of glovepie, but the newer version is even more simple: https://www.youtube.com/watch?v=rii4CYX ... C01DB243F5 . Also read the word document that comes with glovepie0.46

Please let me know if it works. If so you can ask me for any type of script because I've been figuring it out for a while and I think it's fun.

If you're are trying to emulate a ps1 controller I think the only virtual joystick glovepie can output to is ppjoy which I think can do what you want, you can find how to in the tutorial. I'm not really sure if it can use other virtual joysticks.
You said you're trying to emulate swing motion and I take it as emulating the analog stick as you swing around, but if you mean detecting certain motions as a button input that can be done with or without motion plus.
If you're trying to make wii motion plus into analog stick I think it's way harder since you'll have to regularly set the wiimote on the table to calibrate the Motion Plus because drift happens quickly if you swing around too fast, but if you're slow I think it might last a lot longer. You should check my other post (viewtopic.php?t=29309).

The best solution in my opnion you can use gravity itself and just tilt the wiimote so it never drifts(you could do this with no wiimotionplus and you could even use the nunchuck if you want). Glovepie has Wiimote.SmoothPitch which gives a value of -90 to 90(pointing up or down) and Wiimote.SmoothRoll which gives -180 to 180( value 0 when wiimote is facing up). It comes with its own problems like if you're pointing straight up or down the roll gets really sensitive but you can basically just have the pitch values from -45 to 45(or try increasing the angle a little and testing) mapped to the analog values for up and down and have roll -90 to 90 mapped to left and right. But this way makes you have to play very stiff because the wiimote has to be perpendicular to the ground and facing up completely to have no inputs.That's why I think you can use Delta(Wiimote.Smoothpitch) to get the variation in the angle instead and add to the analog values overtime but only when pressing a button, then reset to no input when not pressing. I already have a script with this concept for the mouse cursor, so for example, if you want to go up you press the B button and then tilt up.
if you have questions ask, and also I could try helping you out with a script.

if you really want to use motion plus and don't care about the drift you would basically do the same thing with Wiimote.Yaw and Wiimote.Pitch(these are the motion plus values which tend to drift) and make sure the wiimote faces forward when setting on a table. In a similar way you can get the angle variation values directly in (Wiimote.YawSpeed and Wiimote.PitchSpeed). I recommend checking out lednerg's script from the wiimote scripts that come with glovepie0.46, it allows the wiimote to be facing any direction(except for straight up or down) and do the accurate input, for example, in a simple script if you have the wiimote sideways and tilt up, the Yaw value is the one that changes so the input would be to the right instead of up, in lednerg script it does the correct input.

UPDATE

1. Thanks a lot you manage to help me to be able to use wii motion plus inside controller into Glovepie, it works with version 0.46 at least. At least it is running smoothly, perhaps it shut down when not in usage, going to check it out.
So for people being new like me with wii mote connection:

1. Open control panel, show bigger Icon on the top right for windows 11, open a new window for "Device and Printers" , Find the device and click next for connecting to wii mote.
2. Go to dolphin latest emulator, go to the controller scheme, set to real wii mote in bluetooth adapter, continous scanning and hold sync button on wii mote. It will vibrate so you become player 1.
3. Get GlovePie 0.46, doesnt work with other. Put the simple script first to check the condition and then run.

2. going to check out ppjoy,xpadder and all available options

3. yea going to test out the lednergs script and with the help of chatgpt i may get the optimal solution, unless the software is too outdated. Then I need help with Freepie early implementation from you :)
Update

the wii mote button may work but not the motion tracking, in the debug message it says (wiimotion plus inside)Wii motion Plus is not detected, hence i am waiting for my original wii to arrive so i can test it out
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

hanabara wrote: Tue Feb 13, 2024 9:49 am
hanabara wrote: Tue Feb 13, 2024 9:20 am
tonytony wrote: Sun Feb 11, 2024 4:21 pm Hi Hanabara. I have that same issue and am intimidated by freepie and my computer is not very good so even though it crashes some times, glovepie is very light in terms of resources and is easy to write code in my opinion. My wiimote is hanging in there but I ordered a wiimote with motionplus built-in as well, but I'm new to this and have no idea if it's going to be comptible since I don't have it yet, so I'm also interested in the results you get. If your wiimote is 3rd party I think that's why it doesn't work but I think if it is, it's still worth a shot.
BTW what is the wiimote's name that appears on your computer.

You should download GlovePIE 0.46, and try that executable and the scripts that come with: https://github.com/GlovePIEPreservation ... vePIE-0.46

I advise trying to connect in devices and printers first, I don't actually know if it works with the tr model but if that doesn't work use Dolphin.
Then try writting this in glovepie, run it and then open a notepad to see if it writes, and also check the variables tab:

Code: Select all

Keyboard.A=Wiimote.A
Keyboard.B=Wiimote.B
var.exists=Wiimote.Exists
if glovepie finds the wiimote, var.exists is TRUE, that's the only thing you need to check.

I assume that if that version doesn't work you have to try using this version: https://github.com/GlovePIEPreservation ... PlusTR.zip

if it really doesn't work I really don't know how to help. But as a last effort. If the model name is different than "Nintendo RVL-CNT-01" try changing to it, though I doubt it's going to work.

if it works you can try watching this even though it's a tutorial on an older version of glovepie, but the newer version is even more simple: https://www.youtube.com/watch?v=rii4CYX ... C01DB243F5 . Also read the word document that comes with glovepie0.46

Please let me know if it works. If so you can ask me for any type of script because I've been figuring it out for a while and I think it's fun.

If you're are trying to emulate a ps1 controller I think the only virtual joystick glovepie can output to is ppjoy which I think can do what you want, you can find how to in the tutorial. I'm not really sure if it can use other virtual joysticks.
You said you're trying to emulate swing motion and I take it as emulating the analog stick as you swing around, but if you mean detecting certain motions as a button input that can be done with or without motion plus.
If you're trying to make wii motion plus into analog stick I think it's way harder since you'll have to regularly set the wiimote on the table to calibrate the Motion Plus because drift happens quickly if you swing around too fast, but if you're slow I think it might last a lot longer. You should check my other post (viewtopic.php?t=29309).

The best solution in my opnion you can use gravity itself and just tilt the wiimote so it never drifts(you could do this with no wiimotionplus and you could even use the nunchuck if you want). Glovepie has Wiimote.SmoothPitch which gives a value of -90 to 90(pointing up or down) and Wiimote.SmoothRoll which gives -180 to 180( value 0 when wiimote is facing up). It comes with its own problems like if you're pointing straight up or down the roll gets really sensitive but you can basically just have the pitch values from -45 to 45(or try increasing the angle a little and testing) mapped to the analog values for up and down and have roll -90 to 90 mapped to left and right. But this way makes you have to play very stiff because the wiimote has to be perpendicular to the ground and facing up completely to have no inputs.That's why I think you can use Delta(Wiimote.Smoothpitch) to get the variation in the angle instead and add to the analog values overtime but only when pressing a button, then reset to no input when not pressing. I already have a script with this concept for the mouse cursor, so for example, if you want to go up you press the B button and then tilt up.
if you have questions ask, and also I could try helping you out with a script.

if you really want to use motion plus and don't care about the drift you would basically do the same thing with Wiimote.Yaw and Wiimote.Pitch(these are the motion plus values which tend to drift) and make sure the wiimote faces forward when setting on a table. In a similar way you can get the angle variation values directly in (Wiimote.YawSpeed and Wiimote.PitchSpeed). I recommend checking out lednerg's script from the wiimote scripts that come with glovepie0.46, it allows the wiimote to be facing any direction(except for straight up or down) and do the accurate input, for example, in a simple script if you have the wiimote sideways and tilt up, the Yaw value is the one that changes so the input would be to the right instead of up, in lednerg script it does the correct input.

UPDATE

1. Thanks a lot you manage to help me to be able to use wii motion plus inside controller into Glovepie, it works with version 0.46 at least. At least it is running smoothly, perhaps it shut down when not in usage, going to check it out.
So for people being new like me with wii mote connection:

1. Open control panel, show bigger Icon on the top right for windows 11, open a new window for "Device and Printers" , Find the device and click next for connecting to wii mote.
2. Go to dolphin latest emulator, go to the controller scheme, set to real wii mote in bluetooth adapter, continous scanning and hold sync button on wii mote. It will vibrate so you become player 1.
3. Get GlovePie 0.46, doesnt work with other. Put the simple script first to check the condition and then run.

2. going to check out ppjoy,xpadder and all available options

3. yea going to test out the lednergs script and with the help of chatgpt i may get the optimal solution, unless the software is too outdated. Then I need help with Freepie early implementation from you :)
Update

the wii mote button may work but not the motion tracking, in the debug message it says (wiimotion plus inside)Wii motion Plus is not detected, hence i am waiting for my original wii to arrive so i can test it out
I may keep this forum post alive, so how I found how to make mouse movement script, a guy who made for a light gun game.
Like Castlevania 2009 arcade edition
I believe you set the solution from what you have on screen and the mouse can go around until the invi border.
https://forum.arcadecontrols.com/index. ... c=119924.0
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

Update : the wii with the mousecursor on HDMI:

The script I follow:

mouse.CursorPosX = smooth(1024-round((((wiimote1.dot1x+wiimote1.dot2x)/2)/1024)*1024),3)
mouse.CursorPosY = smooth(round((wiimote.dot1y/784)*768),3)
mouse.LeftButton = Wiimote.B and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.RightButton = Wiimote.A and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.MiddleButton = Wiimote.Home and KeepDown(Wiimote.PointerVisible,0.5s)
Key.Five = Wiimote.Plus
Key.One = Wiimote.Minus
mouse.RightButton + mouse.LeftButton = Wiimote.One

the issue here it cause a smaller border if you have bigger screen like i connect my laptop to hdmi.
By Logic I removed the wiimote.Dot2x (IT is the Infra redlight
Important to write down "yourTvResolution"-round so you want your wii mote go according to your direction or not inverse.

var.screenWidth = 1920
var.screenHeight = 1080

mouse.CursorPosX = smooth(1920-round((Wiimote.Dot1X / 1024) * var.screenWidth), 3)
mouse.CursorPosY = smooth(round((Wiimote.Dot1Y / 768) * var.screenHeight), 3)
mouse.LeftButton = Wiimote.B and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.RightButton = Wiimote.A and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.MiddleButton = Wiimote.Home and KeepDown(Wiimote.PointerVisible,0.5s)
Key.Five = Wiimote.Plus
Key.One = Wiimote.Minus
mouse.RightButton + mouse.LeftButton = Wiimote.One
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

This works only on windows and browser screen, not in game.exe
tonytony
One Eyed Hopeful
Posts: 6
Joined: Tue Feb 06, 2024 10:10 pm

Re: FreePIE Wiimote iR plugin

Post by tonytony »

Hi. I'm glad it works for the most part.

In terms of actually playing a game I think it depends on the game itself and you might also want to check the settings. For example in Minecraft there's an option called Raw Input, I had to turn it off. But I also think that it might be because in a game it might not deal directly with the mouse cursor's position. So for that you might want to control the mouse's position through glovepie, like so:
(keep in mind that with this one, var.x and var.y have to be corrected to be 0 in the center)

Code: Select all

Mouse.DirectInputX=var.x
Mouse.DirectInputY=var.y
The problem is that it needs to be centered in the beggining and also I think it would stop being centered once you pause the game. The best thing I can think of is you have to either press some button to move and add the variation,like this:

Code: Select all

if var.button {
Mouse.DirectInputX+=Delta(var.x)
Mouse.DirectInputY+=Delta(var.y)
}
or have the button switch into using your mouse, center it and then click the button again.


But I think the best way if you don't want to press a button while aiming, is to press a button that makes you have no input, then point at the center of the sensor bar and unpress the button and you're good to go(could be by clicking the button to change the value of a variable that switches the input on or off)

(also by using delta, you don't have to adjust the var.x or var.y to be centered)

Code: Select all

if not var.Button {
	Mouse.DirectInputX+=Delta(var.x)
        Mouse.DirectInputY+=Delta(var.y)
}
Also if you're using a pointer you can check out my mouse script, I'm not sure it's smoother than using dot1 but I prefer it.

Code: Select all

if var.var=0 {
   var.var=1
   var.w=screen.DesktopWidth
   var.h=screen.DesktopHeight
   var.l=screen.DesktopLeft
   var.t=screen.DesktopTop
   var.cx=var.l+(var.w/2)
   var.cy=var.t+(var.h/2)
   //adjust the numbers bellow to reach the border of the screen but without making it too sensitive
   var.wr=var.w*1.4
   var.hr=var.h*1.2
}

if (keyboard.Escape) {
   ShowPIE
   ExitProgram
}
if (SingleClicked(Wiimote.Home)){
   if (Wiimote.B) {

   } else {
    if var.A==0 {
      HidePIE
      var.A=1
   } else {
      ShowPIE
      var.A=0
     }
   }
}
if (DoubleClicked(Wiimote.Home)){
   if (Wiimote.B) {
      ExitPIE
   } else {
      ExitProgram
   }
}
 debug=Wiimote.PointerXY + ' ' + Mouse.CursorPos
var.x=var.cx+(Round((Wiimote.PointerX - 0.5)*var.wr))
var.y=var.cy+(Round((Wiimote.PointerY - 0.5)*var.hr))

if Wiimote.B {
Mouse.CursorPosX=Smooth(var.x,3)
Mouse.CursorPosY=Smooth(var.y,3)
//for games
//Mouse.CursorPosX+=Smooth(Delta(var.x),3)
//Mouse.CursorPosY+=Smooth(Delta(var.y),3)
}

Mouse.LeftButton=Wiimote.A
Mouse.RightButton=Wiimote.Minus

Keyboard.Up=Wiimote.Up
Keyboard.Down=Wiimote.Down
Keyboard.Left=Wiimote.Left
Keyboard.Right=Wiimote.Right
It uses the center of the screen as a reference so that if it fails near the border it will fail on both sides equally, that means that I just need to adjust the sensitivity to calibrate, also I made it so it works with however many monitors you have, I have one extra myself. If you think dot1 is smoother then just try adjusting. The word doc has a lot of information that's usefull to make things like this, though it might be kind of boring to get through. I just use ctrl+f to get the information I want usually.


*EDIT: I think you could try to capture the variation directly like this:

Code: Select all

if not var.Button {
	Mouse.DirectInputX+=Smooth(-Delta(Wiimote.dot1x),3)
        Mouse.DirectInputY+=Smooth(Delta(Wiimote.dot1y),3)
}
with my testing I'm not sure it's a great solution, but you should test it, or try smoothing inside of Delta like this:
if not var.Button {
Mouse.DirectInputX+=-Delta(Smooth(Wiimote.dot1x,3))
Mouse.DirectInputY+=Delta(Smooth(Wiimote.dot1y,3))
}
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

tonytony wrote: Tue Feb 13, 2024 1:01 pm Hi. I'm glad it works for the most part.

In terms of actually playing a game I think it depends on the game itself and you might also want to check the settings. For example in Minecraft there's an option called Raw Input, I had to turn it off. But I also think that it might be because in a game it might not deal directly with the mouse cursor's position. So for that you might want to control the mouse's position through glovepie, like so:
(keep in mind that with this one, var.x and var.y have to be corrected to be 0 in the center)

Code: Select all

Mouse.DirectInputX=var.x
Mouse.DirectInputY=var.y
The problem is that it needs to be centered in the beggining and also I think it would stop being centered once you pause the game. The best thing I can think of is you have to either press some button to move and add the variation,like this:

Code: Select all

if var.button {
Mouse.DirectInputX+=Delta(var.x)
Mouse.DirectInputY+=Delta(var.y)
}
or have the button switch into using your mouse, center it and then click the button again.



I tried this line:

Mouse.DirectInputX+=Smooth(-Delta(Wiimote.dot1x),3)
Mouse.DirectInputY+=Smooth(Delta(Wiimote.dot1y),3)

It may work in-game, but within a certain border and unconsistently jittering


But I think the best way if you don't want to press a button while aiming, is to press a button that makes you have no input, then point at the center of the sensor bar and unpress the button and you're good to go(could be by clicking the button to change the value of a variable that switches the input on or off)

(also by using delta, you don't have to adjust the var.x or var.y to be centered)

Code: Select all

if not var.Button {
	Mouse.DirectInputX+=Delta(var.x)
        Mouse.DirectInputY+=Delta(var.y)
}
Also if you're using a pointer you can check out my mouse script, I'm not sure it's smoother than using dot1 but I prefer it.

Code: Select all

if var.var=0 {
   var.var=1
   var.w=screen.DesktopWidth
   var.h=screen.DesktopHeight
   var.l=screen.DesktopLeft
   var.t=screen.DesktopTop
   var.cx=var.l+(var.w/2)
   var.cy=var.t+(var.h/2)
   //adjust the numbers bellow to reach the border of the screen but without making it too sensitive
   var.wr=var.w*1.4
   var.hr=var.h*1.2
}

if (keyboard.Escape) {
   ShowPIE
   ExitProgram
}
if (SingleClicked(Wiimote.Home)){
   if (Wiimote.B) {

   } else {
    if var.A==0 {
      HidePIE
      var.A=1
   } else {
      ShowPIE
      var.A=0
     }
   }
}
if (DoubleClicked(Wiimote.Home)){
   if (Wiimote.B) {
      ExitPIE
   } else {
      ExitProgram
   }
}
 debug=Wiimote.PointerXY + ' ' + Mouse.CursorPos
var.x=var.cx+(Round((Wiimote.PointerX - 0.5)*var.wr))
var.y=var.cy+(Round((Wiimote.PointerY - 0.5)*var.hr))

if Wiimote.B {
Mouse.CursorPosX=Smooth(var.x,3)
Mouse.CursorPosY=Smooth(var.y,3)
//for games
//Mouse.CursorPosX+=Smooth(Delta(var.x),3)
//Mouse.CursorPosY+=Smooth(Delta(var.y),3)
}

Mouse.LeftButton=Wiimote.A
Mouse.RightButton=Wiimote.Minus

Keyboard.Up=Wiimote.Up
Keyboard.Down=Wiimote.Down
Keyboard.Left=Wiimote.Left
Keyboard.Right=Wiimote.Right
It uses the center of the screen as a reference so that if it fails near the border it will fail on both sides equally, that means that I just need to adjust the sensitivity to calibrate, also I made it so it works with however many monitors you have, I have one extra myself. If you think dot1 is smoother then just try adjusting. The word doc has a lot of information that's usefull to make things like this, though it might be kind of boring to get through. I just use ctrl+f to get the information I want usually.


*EDIT: I think you could try to capture the variation directly like this:

Code: Select all

if not var.Button {
	Mouse.DirectInputX+=Smooth(-Delta(Wiimote.dot1x),3)
        Mouse.DirectInputY+=Smooth(Delta(Wiimote.dot1y),3)
}
with my testing I'm not sure it's a great solution, but you should test it, or try smoothing inside of Delta like this:
if not var.Button {
Mouse.DirectInputX+=-Delta(Smooth(Wiimote.dot1x,3))
Mouse.DirectInputY+=Delta(Smooth(Wiimote.dot1y,3))
}

Mouse.DirectInputX=var.x
Mouse.DirectInputY=var.y

Mouse.DirectInputX+=-Delta(Smooth(Wiimote.dot1x,3))
Mouse.DirectInputY+=Delta(Smooth(Wiimote.dot1y,3))


did make my ingame move, but not precisely as my intended task. So i am stuck here so far. I believe it only moves under the restriction of sensor bar within 10 cm or something.
tonytony
One Eyed Hopeful
Posts: 6
Joined: Tue Feb 06, 2024 10:10 pm

Re: FreePIE Wiimote iR plugin

Post by tonytony »

[/quote]

did make my ingame move, but not precisely as my intended task. So i am stuck here so far. I believe it only moves under the restriction of sensor bar within 10 cm or something.
[/quote]

Then just try to do it directky like this:

Code: Select all

Mouse.DirectInputX=var.x*var.sens
Mouse.DirectInputY=var.y*var.sens
and try to adjust with the mouse if it's not lined up correctly. Just make sure var.x and var.y make sense with the reference you're considering.
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

tonytony wrote: Wed Feb 14, 2024 10:57 pm
did make my ingame move, but not precisely as my intended task. So i am stuck here so far. I believe it only moves under the restriction of sensor bar within 10 cm or something.
[/quote]

Then just try to do it directky like this:

Code: Select all

Mouse.DirectInputX=var.x*var.sens
Mouse.DirectInputY=var.y*var.sens
and try to adjust with the mouse if it's not lined up correctly. Just make sure var.x and var.y make sense with the reference you're considering.
[/quote]

Update

Original wii mote +extention motion plus works with liderg mouse script only , but very shaky in game such as overwatch 2.
Wiimote with motion plus inside works only with glovepie4.6 and none of those official script.(I believe I had to modify in the future similiar script as linderg and bypass the wii motion control check. You can use Wiiunsoft 3.5 but very limited action.

CODE for WII mote with motion inside plus and IR sensor light:

//Mouse cursor for windows and hdmi 1920x1080
//*
var.screenWidth = 1920
var.screenHeight = 1080

mouse.CursorPosX = smooth(1920-round((Wiimote.Dot1X / 1024) * var.screenWidth), 3)
mouse.CursorPosY = smooth(round((Wiimote.Dot1Y / 768) * var.screenHeight), 3)


// for in game
var.scaleX = 1920 / 1024
var.scaleY=1080/768
var.sense = 25 // adjust so you dont point your wii mote outside of ir light sensor. So higher sensitiviy , less motion on your wii mote xD

if Wiimote.Dot1Size > 0{
Mouse.DirectInputX += Smooth(-Delta(Wiimote.Dot1X*var.scaleX)*var.sense, 3)

Mouse.DirectInputY += Smooth(Delta(Wiimote.Dot1Y*var.scaleY)*var.sense, 3)
}
hanabara
One Eyed Hopeful
Posts: 10
Joined: Fri Feb 09, 2024 11:36 am

Re: FreePIE Wiimote iR plugin

Post by hanabara »

The game I was testing,

Castlevania HD 2009 arcade and overwatch 2 with the mouse and Ir script

Ape escape ps1 with Wiiusoft 3.5
Post Reply

Return to “FreePIE”