The engine is optimized taking into account features of ActionScript 3 and the technology Flash.This is especially important for browser-based applications, given the significant limitations in memory and speed for the code that runs in your browser.
A variety of geometric shapes
AlternativaPhysics supports objects of arbitrary shape, with each form of collision detection algorithms specially optimized.
The basic forms
Arbitrary convex polyhedron
Hierarchical entity. Specifies a body consisting of a few basic primitives.
Triangular mesh. Defines a surface of arbitrary (including non-convex) body.
The stability of complex structures
During a physical simulation in AlternativaPhysics maintains stable fixed structures of varying complexity, consisting of a large number of bodies (including the stack, pyramid, and others).This avoids the situation where the objects that are fixed in the real world, when the simulation starts to shake, vibrate, they eventually may lead to the destruction of the structure.
Support restrictions (joints)
You can place restrictions on the movement / position of two objects relative to each other.
The maximum distance
The distance between two objects on which a constraint can not exceed a specified value. For example, you can implement on a rope suspended from the ball, setting limits on the rope attachment point with the maximum distance is equal to the length of the rope.
A fixed distance
The distance between two objects on which a constraint must be equal to the specified value. For example, a ball suspended on a rod.
Ball joints (ball-in-socket)
The distance between two objects must be zero. With such a restriction joints can be implemented.
Rotary, swivel (hinge)
Two objects of this constraint can only rotate relative to each other around an axis. For example, the wheel on the cell suspension.
Integration with Alternativa3D
In addition to the physics engine, we provide a library that allows you to conveniently work with the physical behavior and the image of the same object using the graphics engine Alternativa3D.
A physical object has a graphical representation of itself, so to facilitate the modeling and graphical representation of a physical object they are merged into one.
Also included in the integration library is the class PhysicsSprite, which initializes and automatically updates the graphical and physical scene.
The library is available with a source code.
See example in the knowledge base: An Introduction to AlternativaPhysics.
The native event system
The following types of events: the beginning of the scene update, the ending of the scene update, the appearance of the contact.
Adding and removing of a listener to the event — this is the usual function of addEventListener and removeEventListener.
A more detailed use of events is seen in the lesson AlternativaPhysics events.