I'm new to Box2D, and working on a first project using EaselJS along with Box2DWeb. I'm hoping to have the standard static shapes that comprise the walls and floor of the world to move/update along with the browser window when it's resized. I'm using SetPosition to accomplish it, which is called with each execution of Easel's tick method - and it's almost working. When the browser is made larger, everything works as expected - the floor lowers and the dynamic objects fall accordingly.
However when the browser is made smaller, the bodies in the scene will seem to often fall right through the static floor body and disappear. It seems to occur only if the resize is significant enough to cause the dynamic body in question to briefly descend out of window view (for example, fully below the browser pane when decreasing the height). If I resize the browser reasonably slowly however... strangely enough it works.
I can think of no good solution to my problem, and I have not had any luck finding an example of the behavior on the web. Can it be done? Very grateful for any assistance.
Lee:
Absolutely - thanks so much for the reply. This is a backbone.js project. The example can be seen here:
The basic window resize listener is at the bottom of the file here:
/b2dweb/js/routers/Main.js
...it references app.box2d. That's a backbone view here:
/b2dweb/js/views/Box2DView.js
The 'onStageResize' method is positioning the world boundaries. The update method at the bottom of this class is called 45/sec via the tick method in /b2dweb/js/routers/Main.js.
A zip of the entire effort is zipped here:
http://kensonger.com/b2dweb/box2d_experiment.zip
You can see the box2d/easel objects passing through the floor if you quickly size the browser pane upward, and then downward again quickly. If you don't resize downward, the objects just fall through and vanish. If you do however, the floor passes through once more and catches the falling objects.
Again, thanks a million for any insights - greatly appreciated.