TOUCH & MOVE (Single)


UPDATE: This demo may have some issues. Please check this demo which is 100% working.

In this demo I have tried to implement touch functionality in Box2dWeb. For this I have used jQuery Mobile. Just touch the body with your finger and try to move the body. What happens is when you touch the body, a mouse joint is created with the body. When you release the finger, mouse joint is destroyed and the body is released.

There is only one drawback, albeit a major one, that you can move only ONE body at a time. You cannot move multiple bodies at one time.

I'm also working on a demo for moving multiple bodies at once (using multiple fingers -- depends on your device) but I can't get it to work properly. Also I don't have a touch device to check my demos on. So Steven Lu has helped me a lot in testing this demo as well as the "multiple touch" one (in works). So a big thanks to him.

Meanwhile here's the demo. Also if there happens to be any problem with this demo please comment or give me a feedback (Reply section).

By administrator at 03:02:22 PM 4 Comment(s)


Excellent! This will work well with the Surface tablet for Windows 8. Windows 8 apps can use HTML5 and Javascript, and this is definitely needed! Keep up the great work
By Evertith on 30 Oct, 2012 at 01:09:35 AM
Thanks a lot!
By administrator on 30 Oct, 2012 at 11:32:52 AM
Nice that it works with mouse as well :) Seems to work fine on the devices I tried, but the slower ones seem to miss the touch up event or something, so the mouse joint remains after the touch finishes.
By iforce2d on 30 Oct, 2012 at 02:36:39 PM
What do you mean by slower ones? And does it happen only when you try to move the body using your finger or with the mouse too?
By administrator on 30 Oct, 2012 at 08:10:50 PM

Add a Comment

Please enter the email address.Invalid format. (Won't be Displayed)
Notify me of followup comments
Enter the displayed Code: captcha