| Method | Defined by | ||
|---|---|---|---|
|
resolve(contacts:Array):void
[static]
Resolves an Array of pairwise Contacts
All rigid body contact resolution is handled identically. | CollisionResolver | ||
| resolve | () | method |
public static function resolve(contacts:Array):voidResolves an Array of pairwise Contacts
All rigid body contact resolution is handled identically. The
collision detector ultimately narrows down an Array of type
Contact. Each pairwise contact is explicitly
resolved.
The collision detector currently resolves penetration, so the contact points are legal- that is along the bodies, not within (doing pairwise detection/resolution which handles penetration by directly altering positon results in often-faulty contact generation when an object is in contact with more than 1 object). Solving this issue and all sorts of surrounding problems is a work in progress.
The equation being solved/applied here is:
j = -(1 + e)rV . n / (n . n(iM1 + iM2) + (pv1 . n)^2 / I1 + (pv2 . n)^2 / I2)where:
j = impulse to apply at contact point on both bodies (positive for body 1, negative for body2). e = coefficient of restitution (elasticity of colliding objects) rV = relative velocity of objects at collision point n = collision normal (Vector pointing perpindicularly outward from incident edge) iM1 = inverse mass of body 1 iM2 = inverse mass of body 2 pv1 = velocity of body 1 at point of contact pv2 = velocity of body 2 at point of contact I1 = intertia tensor of body 1 (scalar in 2D) I2 = intertia tensor of body 2 (scalar in 2D)Parameters
contacts:Array — Array of contacts to resolve
|
See also