[WiiFlash] IR sensor
joa e.
j at je2050.de
Fri Sep 21 02:17:12 PDT 2007
Yes, found a way. But we get the same crap like with the C++ version.
float 1.245f from C# will result in 1.2345000505447388 Number in Flash :o)
private static byte[] SingleToBytes( Single f )
{
int size = sizeof(float);
IntPtr ptr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(f, ptr, false);
byte[] result = new byte[size];
Marshal.Copy(ptr, result, 0, size);
Marshal.FreeHGlobal(ptr);
return result;
}
Damn ... Where is Thibault. I can not compile the server :(
joa e. schrieb:
> .NET guy here at the office told me how to do it. Now we have to wait
> for Thibault and you will get the new version pretty quick.
>
> Patrick Matte | BLITZ schrieb:
>
>> Yes I'm using the .NET version. Fortunately I got it before the site got hacked. I think it's still the old version on googlecode.
>>
>> We're showing this project at Adobe MAX next week in Chicago so if you guys get to fix that bug before that it'd be really awesome!
>>
>>
>> BLITZ | Patrick Matte - 310-551-0200 x214
>> -----Original Message-----
>> From: wiiflash-bounces at osflash.org [mailto:wiiflash-bounces at osflash.org] On Behalf Of joa e.
>> Sent: Friday, September 21, 2007 1:07 AM
>> To: wiiflash at osflash.org
>> Subject: Re: [WiiFlash] IR sensor
>>
>> Which server are you currently using? The .NET version? I can not really
>> tell what Thibault did there
>> because I have no idea about .NET.
>>
>> Well -- actually now that I look at it I see some problem.:
>>
>> byte[] x2IRValue =
>> BitConverter.GetBytes(IPAddress.HostToNetworkOrder(Convert.ToInt32(ws.IRState.X2
>> * 100)));
>> byte[] y2IRValue =
>> BitConverter.GetBytes(IPAddress.HostToNetworkOrder(Convert.ToInt32(ws.IRState.Y2
>> * 100)));
>>
>> The IR is a float 0..1 and multiplied only by 100. Then divided by 100
>> in AS3 you will get those choppy values. Unfortunately
>> I can also not compile that stuff ... And you can get a better
>> resolution of the values. I will ask Thibault to finally just pass the float
>> here.
>>
>> Cheers
>>
>> Patrick Matte | BLITZ schrieb:
>>
>>
>>> I was wondering if there was any way to get more decimals out of the
>>> point values coming from the IR?
>>>
>>> I get only 2 decimals right now, so it's really chuggy when i move the
>>> cursor on screen...
>>>
>>> 0.01 means 12 pixels on a 1280 x 720 stage so that's a huge gap when
>>> you try to click on smaller buttons.
>>>
>>> I have some easing on the cursor so it moves in position smoothly but
>>> it's still hard to click on those small buttons...
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> 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
>>
>> _______________________________________________
>> 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