I've been wanting to use physics and multi-touch together. But physics calculations + ME = Years and years and years. But, there are already solutions that I can use to create physics based applications in Flash, but there are many to choose from. So I slowly started sifting through all the choices to find one I understood and work with.
It took a little while, but I began to make sense to me, at least the intial tutorial did, and the additional tutorials that I could find online. Emanuele Feronato » italian geek and PROgrammer IS MY FLASH PHYSICS HERO!
I took built an enclosed area around the outside of the projected screen with 4 walls. Then started with just building a regular flash app which the mouse clicks on a circle, you can drag the circle around and the other circles react to it, just using the normal MouseEvent.MOUSE_DOWN. Done, next. Next I changed the MouseEvent to a TouchEvent, changed the rest of the code as needed to work with just 1 touchpoint. That took a little while to hammer out, and got a bit frustrating here and there. Till I acutally understood everything that was going on in the code when it came to Mouse/Item interaction. Touch and empty part of the stage, new circle, touch a circle, it follows the touchpoint. Done Again.
Finally, get it to understand different touchpoints at the same time. A lot to think about in that one. My solution in a nutshell is that any and all touchpoints are collected into an array, along with the corresponding circle (if the touchpoint is indeed touching a circle), then the code to update any touched circles loops through the array of touchpoints and adjusts the circles positions accordingly. I do not pretend to be a master flash coder in any sense, so I do not know if this is the Best solution, BUT it works and it works very very well, even on a non-high end computer. And I am quite happy with the refresh rate of it all.
Video for show, 3 app demos, 1st is the fire app (comes with Touchlib), 2nd ring app (example from NUI Group), 3rd my physics app demo.
Multi-touch Flash Apps from Chris Yanc on Vimeo.
Quality Note: The compliant surface has temporarily buckled because of the temperate/humidity shift in the weather. I'll be reworking how I lay out the compliant surface next.
I've zipped the files I used, I've edited some of the Touchlib AS files so these files probably won't work if you use the real downloaded version of the Touchlib AS files.
Download Touchlib+Physics
Enjoy (^_^)//
Tags: Box2DFlash, Multi-Touch, physics, Touchlib
Thankyou so match.With your blog, i can do something interesting with mi Multitouch Table.Bye From Andorra.