Packageflare.collisions
Classpublic class MouseCollision
InheritanceMouseCollision Inheritance Object

The MouseCollision class provides tools to detect collision of objects with the mouse or with a 2D coordinate relative to the screen.



Public Properties
 PropertyDefined By
  camera : Camera3D
Camera to be used in checks.
MouseCollision
  collided : Boolean
[read-only] Returns whether collision occurred or not in the last check.
MouseCollision
  collisionCount : int
[read-only] Returns the number of objects to be checked.
MouseCollision
  collisionTime : int
[read-only] Returns the time taken to perform the last check in milliseconds.
MouseCollision
  data : Vector.<CollisionInfo>
CollisionInfo-type vector with the results of the collision.
MouseCollision
  ray : RayCollision
[read-only] An instance of ray collision used to do the tests.
MouseCollision
Public Methods
 MethodDefined By
  
MouseCollision(camera:Camera3D = null)
Creates a new MouseCollision object.
MouseCollision
  
addCollisionWith(pivot:Pivot3D, includeChildren:Boolean = true):void
Adds objects that will be used to check for collisions.
MouseCollision
  
dispose():void
MouseCollision
  
removeCollisionWith(pivot:Pivot3D, includeChildren:Boolean = true):void
Removes a Pivot3D in order to stop its checking process.
MouseCollision
  
test(x:Number, y:Number, getAllPolysUnderPoint:Boolean = false, ignoreInvisible:Boolean = true, ignoreBackFace:Boolean = true):Boolean
Performs the collision check.
MouseCollision
Property Detail
cameraproperty
camera:Camera3D

Camera to be used in checks.


Implementation
    public function get camera():Camera3D
    public function set camera(value:Camera3D):void
collidedproperty 
collided:Boolean  [read-only]

Returns whether collision occurred or not in the last check.


Implementation
    public function get collided():Boolean
collisionCountproperty 
collisionCount:int  [read-only]

Returns the number of objects to be checked.


Implementation
    public function get collisionCount():int
collisionTimeproperty 
collisionTime:int  [read-only]

Returns the time taken to perform the last check in milliseconds.


Implementation
    public function get collisionTime():int
dataproperty 
public var data:Vector.<CollisionInfo>

CollisionInfo-type vector with the results of the collision.

rayproperty 
ray:RayCollision  [read-only]

An instance of ray collision used to do the tests.


Implementation
    public function get ray():RayCollision
Constructor Detail
MouseCollision()Constructor
public function MouseCollision(camera:Camera3D = null)

Creates a new MouseCollision object. Camera and canvas are both optional. If null, those used during the collision are selected.

Parameters
camera:Camera3D (default = null) — Camera3D object that will be used to check the collision.
Method Detail
addCollisionWith()method
public function addCollisionWith(pivot:Pivot3D, includeChildren:Boolean = true):void

Adds objects that will be used to check for collisions.

Parameters

pivot:Pivot3D — Pivot3D object to be checked for collisions
 
includeChildren:Boolean (default = true) — defines whether Pivot3D children are to be included.

dispose()method 
public function dispose():void

removeCollisionWith()method 
public function removeCollisionWith(pivot:Pivot3D, includeChildren:Boolean = true):void

Removes a Pivot3D in order to stop its checking process.

Parameters

pivot:Pivot3D — Pivot3D object to be removed.
 
includeChildren:Boolean (default = true) — defines whether Pivot3D children are to be removed.

test()method 
public function test(x:Number, y:Number, getAllPolysUnderPoint:Boolean = false, ignoreInvisible:Boolean = true, ignoreBackFace:Boolean = true):Boolean

Performs the collision check. "x" and "y" coordinates are relative to the canvas.

Parameters

x:Number — Canvas X coordinate.
 
y:Number — Canvas Y coordinate.
 
getAllPolysUnderPoint:Boolean (default = false) — Defines whether all the collisions or only the first collision are to be taken.
 
ignoreInvisible:Boolean (default = true) — Defines whether invisible objects are to be ignored.
 
ignoreBackFace:Boolean (default = true)

Returns
Booleantrue if collision occurred.