Wiimote Project » General Wiimote and Technology » Programmers Den » GlovePIE and Mouse complications
: [1]
   
: GlovePIE and Mouse complications  ( 11550 )
0 and 1 Guest are viewing this topic.
*
Karma: +0/-0
: 4
Offline Offline
« : January 04, 2010, 08:13:47 PM »

I am using GlovePIE ver0.30.  I have been working on a script used to play Oblivion with the wii remote and nunchuk.  I'm using the IR bar for the mouse.  When I start Oblivion the mouse stays around the top and left borders.  I can't understand why.  Here's my code.
Quote
//I borowed some code
Wiimote.Led1 = true

// Mouse movement
if wiimote.PointerVisible
  mouse.x = wiimote.PointerX
  mouse.y = wiimote.PointerY
end if

// Mouse Buttons
mouse.LeftButton = Wiimote.A and KeepDown(Wiimote.PointerVisible,0.5s)
mouse.RightButton = Wiimote.B and KeepDown(Wiimote.PointerVisible,0.5s)

// Mouse Wheel
If nunchuk.CButton = false then
   if wiimote.Up then
  mouse.WheelUp = true
  wait 30ms
  mouse.WheelUp = false
  wait 30ms
  endif
  if wiimote.Down then
  mouse.WheelDown = true
  wait 30ms
  mouse.WheelDown = false
  wait 30ms
  endif
endif

//character movement
Key.A = (-1.2 < wiimote.Nunchuk.JoyX < -0.5)
Key.D = (0.5 < wiimote.Nunchuk.JoyX < 1.2)
Key.W = (-1.2 < wiimote.Nunchuk.JoyY < -0.5)
Key.S = (0.5 < wiimote.Nunchuk.JoyY < 1.2)

//junp
Key.E = MapRange(Wiimote1.RelAccY, 2 m per s per s,20 m per s per s, 0,1)
//cast
Key.C = MapRange(Wiimote1.Nunchuk.RawForceZ, 10,100, 0,1)
//stealth and running
If Nunchuk.CButton = true then
   If Wiimote1.Up = true then
      Key.CapsLock = true
      wait 500 ms
      Key.CapsLock = false
   Endif
   If Wiimote.Down = true  then
      Key.Ctrl = true
   Endif
Endif

//Hotkeys
If Nunchuk.ZButton = true then
   If Wiimote1.Up = true then
      If Wiimote.Right = true then
         Key.Two = true
      Endif
      If Wiimote.Left = true then
         Key.Eight = true
      Endif
      If Wiimote.left = false then
      If Wiimote.right = false then
         Key.One = true
      Endif
      Endif
   Endif
   If Wiimote1.Down = true then
      If Wiimote.Right = true then
         Key.four = true
      Endif
      If Wiimote.Left = true then
         Key.six = true
      Endif
      If Wiimote.left = false then
         If Wiimote.right = false then
         Key.five = true
         Endif
      Endif
   Endif
   If Wiimote.Up = false then
      If Wiimote.Down = false then
         If Wiimote.Right = true then
            Key.three = true
         Endif
         If Wiimote.Left = true then
            Key.seven = true
         Endif
      Endif
   Endif
Endif

//Escape and Inventory
Wiimote.Home = Key.Escape
Wiimote.Plus = Key.Tab

//Action button
Wiimote.Minus = key.Space
Guru
*
Karma: +28/-0
: 929
Offline Offline
Smoothboard Developer
« #1 : January 04, 2010, 08:44:00 PM »

Have you tried to test your Wiimote's output of the IR dots? You can use debug to see the output of the IR camera in GlovePIE.

Maybe your calculation of the mouse position is wrong causing the pointer to be (0,0).

Regards,
Boon Jin
« : January 04, 2010, 08:47:32 PM boonjin »

Smoothboard
Wii Whiteboard/Wiimote Whiteboard with annotation features and collaborate with multiple iPads and Android Tablets!

Smoothboard for Mac
Using a Mac? Now you can annotate on PowerPoint or Keynote slideshows!

BoonJin[/url
*
Karma: +0/-0
: 4
Offline Offline
« #2 : January 04, 2010, 09:35:37 PM »

I don't believe so because it works fine outside of Oblivion, but as soon as I start Oblivion the mouse pointer screws up.  Also, it isn't at (0,0) it travels along the x and y axes, sorry for the bad explanation.  I would like to note that I'm just a novice programmer, so I don't know too much.

Thank you for the Quick reply :D.
Guru
*
Karma: +28/-0
: 929
Offline Offline
Smoothboard Developer
« #3 : January 04, 2010, 09:56:34 PM »

I don't believe so because it works fine outside of Oblivion, but as soon as I start Oblivion the mouse pointer screws up.  Also, it isn't at (0,0) it travels along the x and y axes, sorry for the bad explanation.  I would like to note that I'm just a novice programmer, so I don't know too much.

Thank you for the Quick reply :D.

Do you mean that the cursor sticks to the sides of the screen but you are able to move the cursor?

How about the other buttons? Does the game respond to the clicks?

In some full screen applications, you may not be able to send the keys to the software correctly.

Regards,
Boon Jin

Smoothboard
Wii Whiteboard/Wiimote Whiteboard with annotation features and collaborate with multiple iPads and Android Tablets!

Smoothboard for Mac
Using a Mac? Now you can annotate on PowerPoint or Keynote slideshows!

BoonJin[/url
*
Karma: +0/-0
: 4
Offline Offline
« #4 : January 04, 2010, 10:38:46 PM »

I found out that it does visit the entire screen, it is just very sensitive.  I had to back up like 15 ft. to keep it from leaving the screen.  Is there a way to fix this?

Also I messed up my code.
Quote
Wiimote.Led1 = true

// Mouse movement
if wiimote.PointerVisible then
  mouse.x = wiimote.PointerX
  mouse.y = wiimote.PointerY
end if

should actually be
Quote
var.ButtonFreezeTime = 250ms
var.PointerBump = KeepDown(Pressed(wiimote.A),var.ButtonFreezeTime) or KeepDown(Pressed(wiimote.B),var.ButtonFreezeTime)

Wiimote.Led1 = true

// Mouse movement
if wiimote.PointerVisible but not var.PointerBump then
  mouse.x = wiimote.PointerX
  mouse.y = wiimote.PointerY
end if

sorry about that.  I think the buttons work, but I can't tell with the mouse this sensitive.
*
Karma: +2/-0
: 64
Offline Offline
« #5 : January 05, 2010, 12:17:43 AM »


Hi,

This advice may help you.

The top left corner is reported by glovepie as (0,0), but the centre of the screen is actually at (512, 384).

To fix the 'stuck cursor' problem you need to be aware of this origin translation and the Y-direction is upside down.

Also try // commenting out your modules // until something actually works properly.

Thanks.



: [1]
   
 
:  

Clicky Web Analytics