Motor Flash Physics: AS3 conversion done
September 19, 2006 on 11:35 am | In Actionscript, Physics | 7 CommentsI am pleased to announce that the development of the motor physics engine has taken a big step towards a first final release.
Nearly all parts of the original code where rewritten and optimized to run as fast as possible in the new AS3 AVM2. I also spent some extra time to write dedicated & lightweight collision algorithms for different shapes instead of treating every object as a convex polygon.
There is yet a lot of optimization potential, for example I’m using a brute-force method for the broad phase collision part, which simply checks every object against each other.
With all this changes, I think that the engine would perform fairly good under AS2, too.
Since this engine is made for games, my focus is on speed and not to get a 100% physical correct result. Thus I allow the objects to overlap and gently push each other away when multiple simultaneous collisions occur. This effect can be reduced by averaging impulses, but for now, the important thing is that the simulation is stable and objects don’t warp through each other. Later on I’ll implement an accuracy-factor to blend between speed & accurateness dynamically and to keep the frame rate at a constant level.
New features:
- a flexible, event driven framework to allow easy integration of new collision and response models, shapes, forces, integrators etc.
- new frame-independent collision detection algorithms supporting spheres, segments, vertices
- blistering fast frame-independent collision detection for axis-aligned and oriented bounding boxes
Currently missing / planned features
- reduce overlapping, better stacking
- different broad phase culling strategies (currently bruteforce only)
- ‘hybrid’ shapes composed of edges and curves, such as rounded blocks
- soft bodies
- rigid constrains
- proximity tests
- optimize, optimize, optimize ;-)
Watch the AS3 preview (popup, Flash Player 9)