I created a box2dweb app with deviceorientation detection but everything is in slowmotion on mobile. Any tips on how it will move without lagging. I only got 10 objects and its slow.
Apps for mobile
JavascriptIf you want some help, you will most likely need to be much more descriptive than that. For example...
- What browser are you using?
- What OS?
- What are the specs of the phone?
- how slow is slow? What are you comparing to, when you decide that it's slow?
- is it the physics or the rendering that's slow? Is it still slow if you do physics without rendering anything?
- is the deviceorientation somehow relevant to the question? Is that what's making it slow?
- What browser are you using?
- What OS?
- What are the specs of the phone?
- how slow is slow? What are you comparing to, when you decide that it's slow?
- is it the physics or the rendering that's slow? Is it still slow if you do physics without rendering anything?
- is the deviceorientation somehow relevant to the question? Is that what's making it slow?
I'm creating an app that is HYBRID. Right now, I'm testing my Box2D app in IPHONE4 and its slower than the emulator am using. It's like 2 secs delay and its really slow and pausing per step. I have this emulator and the apps is working smoothly on it (development kit). I haven't added any rendering yet so it's just the plain box2d physics that is slow (I think) but I tried 1-4 objects and its smooth but when make it 10 objects it started to slow down. My goal is to have at least 30 objects in a box and use deviceorientation to play with them. I tried removing the deviceorientation but still its slow. 🙁
I'm not sure what you mean by hybrid - you mean it's not running on a html canvas in a browser?
Sorry for the confusion. Hybrid Apps that works both on android and ios platform.
So... is it running on a html canvas in a browser?
Canvas yes! Browser not sure because its an app. I don't know if the app is accessing the browser. Let me get that information.
Let's just say its a browser. How can it be improved? Is there a way? Because I've been reading online discussion and once the objects are many in mobile, everyone says it will be slow. I'm trying to decide, if I will continue using BOX2DJS or just move to develop in IOS with XCODE & BOX2D there 🙁
update: I used IPHONE5 just right now and it seems to be smooth with just a millisecond delay. hhhmmm before I use IPHONE4S. so, it maybe on the device specification. But still waiting if there are tweaks to improve it. if anyone got something to share.
update: I used IPHONE5 just right now and it seems to be smooth with just a millisecond delay. hhhmmm before I use IPHONE4S. so, it maybe on the device specification. But still waiting if there are tweaks to improve it. if anyone got something to share.
Let's just say its a browser.
Let's not. The reason I asked that is because I suspect the fact that it's running in something other than a normal web-browser, could be the very reason for the problem. What framework are you using to get it onto iOS and Android? That should have been the very first thing to mention (and it was one of my first questions) so that people reading the thread can have any clue about what we are dealing with.
It's possible that the framework uses a webkit implementation internally, but what else is it doing that uses extra processing, could be important. What speeds are other users of the framework seeing with similar scenes? Are there forums for the framework where you could get some ideas about what the issue could be?
To answer the question of whether it's the application framework that is causing the slowdown, you could try running the same scene a normal web-browser (as in the example you linked to in your other thread) and compare them.
I used INTEL XDK.
Here's is their explanation:
The app built using Intel XDK uses default webview of the respective device. Your HTML5 code is wrapped in a native wrapper and runs inside the default web engine that the device comes with(for e.g. webkit), which is the same engine used by the default browser of your device. When you use HTML5 canvas, it uses the same engine.
I already added the rAF.js still just a minor improvement. Is there other workaround to speed this up?
Here's is their explanation:
The app built using Intel XDK uses default webview of the respective device. Your HTML5 code is wrapped in a native wrapper and runs inside the default web engine that the device comes with(for e.g. webkit), which is the same engine used by the default browser of your device. When you use HTML5 canvas, it uses the same engine.
I already added the rAF.js still just a minor improvement. Is there other workaround to speed this up?
Original thread: https://box2d.org/forum/viewtopic.php?t=9792