Flafla2 / Unity-Wiimote

An easy to use interface between Unity3D / C# and a Wii Remote controller.
MIT License
329 stars 73 forks source link

Accel doesnt work, gyro drifts instantly. No sensor fusion? #39

Open odivalq opened 7 years ago

odivalq commented 7 years ago

Hi, the unity project seems to work okay, however I get no indication that accelerometer is working. In the vídeo I can see some red lines indicating the direction of the acceleration vectors, but no such thing appears for me.

Also the motion plus drifts instantly after initialization whereas in the vídeo it seems to remain largely reliable for at least a few minutes. Could that be related to the seemingly nonworking accelerometer input?

Having asked these, is there some sort of sensor fusion at work in the API?

Thanks in advance!

Flafla2 commented 7 years ago
  1. To see the accelerometer line, make sure the "Draw gizmos" button is pressed in the game view (top right).
  2. To minimize motionplus drift, make sure to lay the WMP down flat on a table and click the "Zero out WMP" button
  3. The only sensor fusion I have implemented right now is when you zero out the WMP. this reorients the remote so that it is facing forward and aligned with the accelerometer (assumed to represent gravity).
odivalq commented 7 years ago

Oh, do I feel silly now. Thank you very much Flafla2, it seems to work as intended now. Just one thing: sometimes during playtest of the default scene of the project you suplied some hiccups happens, about twice per minute, and although they barely last half a second they desync the wiimote model orientation with the real one. Any ideas on might be going on?

Flafla2 commented 7 years ago

@odivalq Perhaps this is an issue with your bluetooth stack? Possibly your bluetooth equipment can't keep up with updates. I'm not completely sure though - it could also be a software issue. Are you getting FPS drops when these issues pop up?

cascross123 commented 7 years ago

Hey, I'm trying to work with the Accelerometer data, but from the documentation I can't seem to work out how to actually get the controllers accel data, do you happen to have any example code or anything I could take a look at?

Flafla2 commented 7 years ago

@cascross123 See here

cascross123 commented 7 years ago

Hey, Thats great, though i'm being thrown errors "Object reference not set to an instance of an object", any ideas?