[WiiFlash] improving IR mapping

christopher watts chris.watts.ol at gmail.com
Mon Dec 31 08:10:30 PST 2007


Greetings, i am using the wiimote IR data to make a point to the screen in
flash, similar to using it to control a mouse.I am able to get the
coordinates to work fine, but the motions seems a little sloppy and jumpy.
The IR data does not seem to match the screen data exactly. I am using a
16:9 screen ratio but it still seems to map a little off in the horizontal.
below is an example of the basic test code i am using.

Does anyone have any advice for interpolating the IR data to make the
movement smoother and more accurate for a given screen size?




function frameHandle (e:Event) {

trace ("frane handler running",myWiimote.ir.x1,myWiimote.ir.x2,
myWiimote.ir.y1 )

    pointOne.x= ((1-myWiimote.ir.point1.x) * 1024)
    pointOne.y= (myWiimote.ir.point1.y * 576)

    pointTwo.x= ((1-myWiimote.ir.point2.x) * 1024)
    pointTwo.y= (myWiimote.ir.point2.y * 576)


    if (myWiimote.ir.p1==true && myWiimote.ir.p2==true) {

        var thePoint:Point = Point.interpolate( myWiimote.ir.point1,
myWiimote.ir.point2,.5)

        pointInt.x = ((1-thePoint.x) * 1024)
        pointInt.y = ((thePoint.y) * 576)
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/wiiflash_osflash.org/attachments/20071231/2c717d93/attachment.html 


More information about the WiiFlash mailing list