[WiiFlash] Wiimote "Z" space & other data

Brad brad at rustpunk.co.za
Tue Nov 20 12:10:23 PST 2007


I've just started working on the same thing ( ir to x/y/z), and although 
the code is very basic and still needs a lot of work, it'll provide you 
with simple x/y screen co-ordinates. (Code currently only works if the 
pitch and yaw remain relatively netural). It would be great if anyone 
else who's done more in depth work on this, would post some code.

I used only co-ordinates received from point 1 of the ir bar ( as I am 
getting some really bizarre readings for point2). Point data is received 
as values of between 0 and 1 (0 right, and 1 left), which where used to 
calculate position  of mc, "pointer". 

import org.wiiflash.Wiimote;
import org.wiiflash.events.WiimoteEvent;

var wiimote: Wiimote = new Wiimote();
var irX:uint;  //ir point1 x value
var irY:uint;  //ir point1 y values
var stageWidth:uint=stage.stageWidth/100;
var stageHeight:uint=stage.stageHeight/100;

wiimote.addEventListener(WiimoteEvent.UPDATE, onUpdated);
wiimote.connect();

function onUpdated (e:WiimoteEvent):void {
    irX=Math.round((1-wiimote.ir.x1)*100);
    irY=Math.round(wiimote.ir.y1*100);
    pointer.x=stageWidth*irX;
    pointer.y=stageHeight*irY;   
}

If you are getting consistent readings for point1 and point 2 objects, 
you should be able to create z data by simply calculating the distance 
between the 2 points x values.

I'd be grateful if anyone could provide some simple code examples for 
the peak detection object.

Brad Roodt
www.tokyostudio.co.za


, Jason wrote:
> Nobody?  Surely several people here have done this before.    
>
> Really, if someone could just explain how to take the Wiimote data and
> translate that to moving an object to X and Y (and bonus - scaling or
> "Z") locations, that would be great.  I've read a lot online about the
> Wiimote, but having a hard time wrapping around how to translate that
> to, for one example, Flash X and Y coordinates.  
>
> Jason Merrill
> Bank of America  
> Learning & Leadership Development for Global Technology & Operations
> eTools & Multimedia Research & Development
>
>  
>
>   
>>> -----Original Message-----
>>> From: wiiflash-bounces at osflash.org 
>>> [mailto:wiiflash-bounces at osflash.org] On Behalf Of Merrill, Jason
>>> Sent: Friday, November 16, 2007 10:34 AM
>>> To: wiiflash at osflash.org
>>> Subject: Re: [WiiFlash] Wiimote "Z" space & other data
>>>
>>>       
>>>>> You could have a look at this page (or at least the diagram), it 
>>>>> helped me to somewhat make sense of the data coming from 
>>>>>           
>>> the Wiimote:
>>>       
>>>>> http://www.wiili.org/index.php/Motion_analysis. 
>>>>>           
>>> Thanks Alex.  I read that, there is a lot of useful stuff on 
>>> there which I am still absorbing,  but a lot of it was 
>>> somewhat greek to me.  I was hoping someone could show some 
>>> Actionscript examples of converting input from the Wiimote 
>>> into angles, degrees, X,Y, Z changes, etc.
>>>
>>> For an example of what I mean by a lot of it is greek to me 
>>> on that page, quote: 
>>>
>>> "A(t) = R(t)(gz+Ar(t))+R(t)Ar(t) where R is the rotation 
>>> matrix which transforms from the "living room frame" to the 
>>> local frame of the remote, and At is the actual acceleration 
>>> of the remote in the "living room frame". The rotation matrix 
>>> is parameterized by 3 Euler angles, and the remote's linear 
>>> acceleration has 3 components as well. With 6 dynamical 
>>> variables, but only 3 observables, our system is underdetermined!"  
>>>
>>> Huh????  I wasn't a math major and I didn't think 
>>> "underdetermined" was even a word until I wikipedia'ed it.
>>>
>>> I just want to figure out how to move a sprite/movieClip 
>>> left, right, up, down, (and in-out scaling based on z-depth 
>>> movement) on the stage based on Wiimote data. hmmph.  Anyone 
>>> have any examples?  I have looked at some of John Grden/'s 
>>> code on his blog, and that's useful too, but he's also mixing 
>>> in a lot of other things - like a "plane" object for 
>>> controlling an object in Papervision3D - so it's hard to pick 
>>> parts of his code out that would be useful to me.
>>>
>>> Jason Merrill
>>> Bank of America
>>> Learning & Leadership Development for Global Technology & 
>>> Operations eTools & Multimedia Research & Development
>>>
>>>
>>>
>>> _______________________________________________
>>> WiiFlash mailing list
>>> WiiFlash at osflash.org
>>> http://osflash.org/mailman/listinfo/wiiflash_osflash.org
>>>
>>>       
>
> _______________________________________________
> WiiFlash mailing list
> WiiFlash at osflash.org
> http://osflash.org/mailman/listinfo/wiiflash_osflash.org
>
>   



More information about the WiiFlash mailing list