Packageorg.rapidphysics.islands
Classpublic class Island
InheritanceIsland Inheritance Object
Subclasses PointCircleIsland, PointLineIsland

Base class for a collection of objects whose collisions should be solved. Subclasses should define lists of objects with which to compare. This class contains the core collision solving algorithm common to all Islands.



Public Properties
 PropertyDefined By
  collisionsResolvedThisFrame : Number
[read-only]
Island
Protected Properties
 PropertyDefined By
  collectCollisionsCount : Number
Island
  collectCollisionsMax : Number = 15
A mechanism to prevent infinite loops.
Island
  collisions : RapidHeap
A collection of collisions sorted by time (very fast)
Island
  doubleDict : Dictionary
Double dictionary of resolved collision times maps [obj1][obj2] => [time of latest collision resolution]
Island
  m_collisionsResolvedThisFrame : Number
How many collisions resolved this frame.
Island
Public Methods
 MethodDefined By
  
Island
  
solve():void
Solves all of the collisions in the island.
Island
Protected Methods
 MethodDefined By
  
Call this function in your implementation of collectCollisions()
Island
  
collectCollisions(frameTime:Number):void
Override this method with your collision detection code
Island
  
Island
  
This is the core collision solving algorithm for all of RapidPhysics.
Island
Property Detail
collectCollisionsCountproperty
protected var collectCollisionsCount:Number

collectCollisionsMaxproperty 
protected var collectCollisionsMax:Number = 15

A mechanism to prevent infinite loops. Don't try to solve collisions more than this number of times per frame

collisionsproperty 
protected var collisions:RapidHeap

A collection of collisions sorted by time (very fast)

collisionsResolvedThisFrameproperty 
collisionsResolvedThisFrame:Number  [read-only]


Implementation
    public function get collisionsResolvedThisFrame():Number
doubleDictproperty 
protected var doubleDict:Dictionary

Double dictionary of resolved collision times maps [obj1][obj2] => [time of latest collision resolution]

m_collisionsResolvedThisFrameproperty 
protected var m_collisionsResolvedThisFrame:Number

How many collisions resolved this frame. Useful for debugging!

Constructor Detail
Island()Constructor
public function Island()



Method Detail
addCollision()method
protected function addCollision(c:Collision):void

Call this function in your implementation of collectCollisions()

Parameters

c:Collision

collectCollisions()method 
protected function collectCollisions(frameTime:Number):void

Override this method with your collision detection code

Parameters

frameTime:Number

recycleCollision()method 
protected function recycleCollision():Collision

Returns
Collision
solve()method 
public function solve():void

Solves all of the collisions in the island. Called by an IslandManager each frame.

solveCollisions()method 
protected function solveCollisions():void

This is the core collision solving algorithm for all of RapidPhysics. Don't override this unless you know what you're doing! While there are collisions to resolve, resolve them. This algorithm solves collisions perfectly, but is somewhat slow. Try to avoid large numbers of objects that frequently collide with each other.