- Calculates gravitational force
- Simulates inelastic collisions
- Provides example UI
The system can stop and start updating on ENTER_FRAME using the following functions:
system.pause();
system.resume();
The system is calculating on ENTER_FRAME by default when it is initialized.
Bodies are initialized in the following way: ```actionscript var b:Body = new Body(x:Number, y:Number, mass:Number, velocity:Geovector); ```Bodies have the following public properties:
velocity:Geovector
mass:Number //read-only
radius:Number //read-only
Geovectors can be added or subtracted from other geovectors:
v.add(v2:Geovector);
v.subtract(v2:Geovector);
Geovectors can be split into their components using their x and y functions:
v.x():Number
v.y():Number
Geovectors have the following public properties:
magnitude:Number
angle:Number
When two bodies collide (when the distance between them is less than the sum of their radii), they are replaced with a single body with their combined mass. The resulting body's velocity is found assuming it is a perfectly inelastic collision using the formula m1v1 + m2v2 = (m1 + m2)v'