WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Best IR-mouse-script (maybe I found something)

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts
View previous topic :: View next topic  
Author Message
skyworxx



Joined: 04 Jan 2007
Posts: 53

Digg It
PostPosted: Wed Jan 17, 2007 11:33 am    Post subject: Best IR-mouse-script (maybe I found something)

what is the best ir-mouse-script at the moment?

all the scripts i tested have the same problem:
only when I point at the middle of two irr-lights the mouse is at the center of the screen. but because of the two lights are below the monitor, the pointing doesnt really fit the mouse on the screen

is there a good and smooth ir-mouse script out there?


Last edited by skyworxx on Wed Jan 17, 2007 7:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
Mugga



Joined: 01 Jan 2007
Posts: 12

Digg It
PostPosted: Wed Jan 17, 2007 6:04 pm    Post subject:

i think its best when you would use the newest version of wiinremote! It's just wonderful and very precise. i tried it with two candle's and it works great! but how can i map the analog stick of the nunchuck, so that i can play hl2 with wiinremote?
Back to top
View user's profile Send private message
Pat1487



Joined: 08 Jan 2007
Posts: 59

Digg It
PostPosted: Wed Jan 17, 2007 7:49 pm    Post subject:

key.D = (Wiimote.Nunchuk.JoyX > .2)
key.S = (Wiimote.Nunchuk.JoyY > .2)
key.A = (Wiimote.Nunchuk.JoyX < -.2)
key.W = (Wiimote.Nunchuk.JoyY < -.2)
Back to top
View user's profile Send private message
skyworxx



Joined: 04 Jan 2007
Posts: 53

Digg It
PostPosted: Wed Jan 17, 2007 7:52 pm    Post subject:

if found this script in one of the big threads:

Code:
// --- 2. Calibration ---
// To calibrate, don't push the analog stick in any direction, run this program and put the Wiimote on a flat surface face-up.
// Then read the values in the debug line (next to the run button).
// Change these values until the debug line reads approx. all zeros.


var.xtrim = 0       // Wiimote X
var.ytrim = -26     // Wiimote Y
var.ztrim = -3       // Wiimote Z

// --- 3. The Sensorbar ---
// Where is your sensorbar?
var.sensorbar = 0  //set 1 for ontop and 0 for below

//Set space between the sensorbar and your tv/monitor in pixel
var.sensorposy = 100 // 0-400

// --- 4. Rumblefunction ---
var.rumble = 1 // 1 = on | 0 = off


// You may now begin playing. Have fun!









// the main-code begins here!

//rumblefunction - simple, but it works :D
if var.rumble then
   if wiimote.B then
      Wiimote.Rumble = true
      wait 20ms
      wiimote.Rumble = false
      wait 3ms
    endif
endif


//buttons, analog stick, etc.
Mouse.LeftButton = wiimote.B
Mouse.RightButton = wiimote.A
Key.R = wiimote.Down
Key.E = wiimote.Home
Mouse.WheelUp = wiimote.Plus
Mouse.WheelDown = Wiimote1.Minus
Key.LeftControl = Wiimote1.Nunchuk.ZButton

Key.B = wiimote.One
Key.F = wiimote.Two


//Mouse Control Script using IR
//by vkapadia with much assistance from inio
//vkapadia@vkapadia.com

//THIS IS A MODIFIED VERSION BY ÖHR


var.accx = wiimote.RawForceX + var.xtrim
var.accy = wiimote.RawForceY + var.ytrim
var.accz = wiimote.RawForceZ + var.ztrim

if wiimote.dot1vis and wiimote.dot2vis then

  if var.accy > -7 then
    var.orientation = 0
  elseif var.accy > -45 then
    if var.accx < 0 then
      var.orientation = 3
    else
      var.orientation = 1
    endif
  else
    var.orientation = 2
  endif

  if var.leftpoint = 0 then
    if var.orientation = 0 then
      if wiimote.dot1x < wiimote.dot2x then
        var.leftpoint = 1
      else
        var.leftpoint = 2
      endif
    endif
    if var.orientation = 1 then
      if wiimote.dot1y > wiimote.dot2y then
        var.leftpoint = 1
      else
        var.leftpoint = 2
      endif
    endif
    if var.orientation = 2 then
      if wiimote.dot1x > wiimote.dot2x then
        var.leftpoint = 1
      else
        var.leftpoint = 2
      endif
    endif
    if var.orientation = 3 then
      if wiimote.dot1y < wiimote.dot2y then
        var.leftpoint = 1
      else
        var.leftpoint = 2
      endif
    endif
  endif

  if var.leftpoint = 1 then
    var.fix1x = wiimote.dot1x
    var.fix1y = wiimote.dot1y
    var.fix2x = wiimote.dot2x
    var.fix2y = wiimote.dot2y
  else
    var.fix1x = wiimote.dot2x
    var.fix1y = wiimote.dot2y
    var.fix2x = wiimote.dot1x
    var.fix2y = wiimote.dot1y
  endif

  var.dx = var.fix2x - var.fix1x
  var.dy = var.fix2y - var.fix1y
  var.cx = (var.fix1x+var.fix2x)/1024.0 - 1
  var.cy = (var.fix1y+var.fix2y)/1024.0 - .75

  var.d = sqrt(var.dx*var.dx+var.dy*var.dy)

  var.dx = var.dx / var.d
  var.dy = var.dy / var.d

  var.ox = -var.dy*var.cy-var.dx*var.cx;
  var.oy = -var.dx*var.cy+var.dy*var.cx;

  var.ax = (var.ox * screen.desktopwidth) + (screen.desktopwidth / 2)
  var.ay = (-var.oy * screen.desktopwidth) + (screen.desktopheight / 2)

  var.dx = var.ax - mouse.cursorposx
  var.dy = var.ay - mouse.cursorposy

  var.d = sqrt((var.dx*var.dx)+(var.dy*var.dy))

  var.a = 180 / (200 + var.d * var.d * var.d * .001)

  var.finalx = mouse.cursorposx * var.a + var.ax * (1 - var.a)
  var.finaly = mouse.cursorposy * var.a + var.ay * (1 - var.a)

  if var.sensorbar = 1 then
     if var.sensorposy <= 400 and var.sensorposy >= 0 then
          var.sensory = var.sensorposy
     elseif var.sensorposy > 400 then
          var.sensory = 400
     elseif var.sensorposy < 0 then
          var.sensory = 0
     endif
  else
     if var.sensorposy <= 400 and var.sensorposy >= 0 then
          var.sensory = var.sensorposy*(-1)
     elseif var.sensorposy > 400 then
          var.sensory = -400
     elseif var.sensorposy < 0 then
          var.sensory = 0
     endif
  endif

  mouse.cursorposx = var.finalx
  mouse.cursorposy = var.finaly - var.sensory

else

  var.leftpoint = 0

endif

debug = " Wiimote X: "  + var.accx + "   Wiimote Y: " + var.accy + "   Wiimote Z: " + var.accz


it uses an offset, so the pointing is really nice. you can also tilt your wiimote without having problems with the sensor, because it uses the g-sensors

but.... it is really jumpy..maybe this can be fixed by a deadzone (but this maybe makes it a lot more unprecise Confused )
Back to top
View user's profile Send private message
Pat1487



Joined: 08 Jan 2007
Posts: 59

Digg It
PostPosted: Wed Jan 17, 2007 8:12 pm    Post subject:

im about to test wiinremote in a game, seems to work great on the desktop, but i doubt it will do well in an fps.

None of the IR scripts ive come across get the job done for fps's, and i dont want to use motion sensing to move the mouse

EDIT:
Yeah wiinremote is probably the worst IR mouse for an fps, but it makes a really good desktop mouse

Ive found this to be the best IR fps mouse (i didnt write this, and i dont know who did, i have a script with this in it, no name, nothing)

Code:
var.xOffset = 0
var.yOffset = 0
var.irAmount = 2
// Master Sensitivity (Default 80) - Change Not Recommended
var.smooth = 80
// Look Speed (Default 1)
var.speed = 1
var.zoom = 1/2
// Less Sensitive Area Around Cursor (Default 40)
var.deadzone = 40

If var.irAmount = 2 Then
   var.xPos = (Wiimote.dot1x + Wiimote.dot2x) / 2
   var.yPos = (Wiimote.dot1y + Wiimote.dot2y) / 2
Else
   var.xPos = Wiimote.dot1x
   var.yPos = Wiimote.dot1y
EndIf

If Wiimote.dot1vis Then
   // Locate Inrared Point Coordinates
   var.actualX = (1-(round(var.xPos) / 1024)) * Screen.Width
   var.actualY = ((round(var.yPos) / 768)) * Screen.Height
   // Determine Look Speed
   var.speedX = (((var.actualX / (Screen.Width / 2)) - 1) * var.smooth) + var.xOffset
   var.speedY = (((var.actualY / (Screen.Height / 2)) - 1) * var.smooth) + var.yOffset
   // Calculate Point-Range Multipliers
   If abs(var.speedX / var.deadzone) > 1 Then var.multX = 1 Else var.multX = abs(var.speedX / var.deadzone)
   If abs(var.speedY / var.deadzone) > 1 Then var.multY = 1 Else var.multY = abs(var.speedY / var.deadzone)
   // Scoped And Normal Multipliers
   If Wiimote.A = True Then
   var.speedX = var.speedX * var.zoom
   var.speedY = var.speedY * var.zoom
   Else
   var.speedX = var.speedX * var.speed
   var.speedY = var.speedY * var.speed
   EndIf
   // Move Cursor
   If abs(var.speedX) > 0 Then Mouse.CursorPosX = Mouse.CursorPosX + (var.speedX * var.multX)
   If abs(var.speedY) > 0 Then Mouse.CursorPosY = Mouse.CursorPosY + (var.speedY * var.multY)
   // Backup Last Motions
   var.lastX = var.speedX
   var.lasty = var.speedY
Else                        // If dot is not visible use last known value
   If abs(var.lastX) > 1 Then Mouse.CursorPosX = Mouse.CursorPosX + var.lastX
   If abs(var.lastY) > 1 Then Mouse.CursorPosY = Mouse.CursorPosY + var.lastY
EndIf
debug = 'Debug: SpeedY: ' + var.speedY + '  SpeedX: ' + var.speedX


theres no calibration required, and it works pretty well, still hoping someone makes a better one though, because with this one it feels like your dragging the mouse
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group