Packagecc.cote.airbag
Classpublic class Collision
InheritanceCollision Inheritance Object

The Collision class contains information about a collision that occured between two DisplayObjects. For instance, the AirBag.detect() method returns a vector of such objects when performing collision detection.

See also

cc.cote.airbag.AirBag


Public Properties
 PropertyDefined By
  angle : Number
[read-only] The angle of the collision (in radians) between the two DisplayObjects.
Collision
  angleInDegrees : Number
[read-only] Returns the angle (in degrees) of the collision between the two DisplayObjects.
Collision
  objects : Vector.<DisplayObject>
[read-only] A vector of the two DisplayObjects that collided.
Collision
  overlapping : Vector.<Point>
[read-only] A vector of all the overlapping points during the collision (in stage coordinates).
Collision
Public Methods
 MethodDefined By
  
Collision(objects:Vector.<DisplayObject>, angle:Number, overlapping:Vector.<Point> = null)
Creates a Collision object.
Collision
  
toString():String
Returns a string representation of the object.
Collision
Property Detail
angleproperty
angle:Number  [read-only]

The angle of the collision (in radians) between the two DisplayObjects. It will return NaN if the angle calculation was not performed (for performance reasons).

If you need the angle in degrees, you can use the angleInDegrees property.


Implementation
    public function get angle():Number
angleInDegreesproperty 
angleInDegrees:Number  [read-only]

Returns the angle (in degrees) of the collision between the two DisplayObjects. If you need the angle in radians, simply use the angle property.


Implementation
    public function get angleInDegrees():Number
objectsproperty 
objects:Vector.<DisplayObject>  [read-only]

A vector of the two DisplayObjects that collided. Note: the AirBag class will always put the singleTarget (if one has been defined) at index 0.


Implementation
    public function get objects():Vector.<DisplayObject>
overlappingproperty 
overlapping:Vector.<Point>  [read-only]

A vector of all the overlapping points during the collision (in stage coordinates). This could be null if the calculation was not performed (for performance reasons).


Implementation
    public function get overlapping():Vector.<Point>
Constructor Detail
Collision()Constructor
public function Collision(objects:Vector.<DisplayObject>, angle:Number, overlapping:Vector.<Point> = null)

Creates a Collision object. This object contains properties describing a collision that was detected between two objects (typically by the AirBag class).

Parameters
objects:Vector.<DisplayObject> — A vector of the objects that collided.
 
angle:Number (default = NaN) — The angle of collision (in radians)
 
overlapping:Vector.<Point> (default = null) — A vector of all overlapping points between the colliding objects
Method Detail
toString()method
public function toString():String

Returns a string representation of the object. Useful mostly for debugging purposes.

Returns
String