Packageorg.MARS.dynamics.collision
Interfacepublic interface ICoarseCollisionDetector
ImplementorsAABRDetector

Imposes minimum structure necessary for the PhysicsEngine to coarsely cull collision instances which aren't worth the more expensive fine phase of detection.



Public Properties
 PropertyDefined by
  factory : ICollisionFactory
[write-only] Sets the ICollisionFactory used to return a certain type of IFineCollisionDetectors.
ICoarseCollisionDetector
Public Methods
 MethodDefined by
  
addCollidable(collidable:Shape):void
Adds a collidable element to detect for collision
ICoarseCollisionDetector
  
getCandidates():Array
Gets all pairwise elements that require fine collision detection

As an optimization, this Array is populated with IFineCollisionDetector instances.

ICoarseCollisionDetector
  
Gets dynamic collidable elements
ICoarseCollisionDetector
  
removeCollidable(collidable:Shape):void
Removes a collidable element from coarse detection
ICoarseCollisionDetector
Property detail
factoryproperty
factory:ICollisionFactory  [write-only]

Sets the ICollisionFactory used to return a certain type of IFineCollisionDetectors.

This opens up the easy swappability of entire detection sets

Implementation
    public function set factory(value:ICollisionFactory):void

See also

PhysicsEngine
Method detail
addCollidable()method
public function addCollidable(collidable:Shape):void

Adds a collidable element to detect for collision

Parameters
collidable:Shape — element to add for detection

See also

ISimulatable
PhysicsEngine
removeCollidable
getCandidates()method 
public function getCandidates():Array

Gets all pairwise elements that require fine collision detection

As an optimization, this Array is populated with IFineCollisionDetector instances. In practice- when a pairwise coarse collision check yields intersection, an IFineCollisionDetector instance is created, rather than requiring the PhysicsEngine to reiterate over a two-dimensional Array.

TODO: AS3 does not offer typed Arrays- it may be worthwhile in the future to change this to a typed LinkedList

Returns
Array — Array of IFineCollisionDetectors representing all collisions which were not ruled out by coarse detection.

See also

IFineCollisionDetector
PhysicsEngine
getDynamicCollidables()method 
public function getDynamicCollidables():Array

Gets dynamic collidable elements

Returns
Array — Array of all dynamic elements
removeCollidable()method 
public function removeCollidable(collidable:Shape):void

Removes a collidable element from coarse detection

Parameters
collidable:Shape — element to remove from detection

See also

ISimulatable
PhysicsEngine
removeCollidable