Package | flare.collisions |
Class | public class RayCollision |
Inheritance | RayCollision ![]() |
The RayCollision class has a wide variety of applications. It could be used to find out which object is below a given character or to align an object in an area by shooting a ray in a downward direction or even to calculate where this object will impact a bullet moving in a specific direction, etc. Information about the environment can be taken by shooting virtual rays in any direction from a given position.
Property | Defined By | ||
---|---|---|---|
collided : Boolean [read-only]
Returns whether collision occurred or not in the last check. | RayCollision | ||
collisionCount : int [read-only]
Returns the number of objects to be checked. | RayCollision | ||
collisionTime : int [read-only]
Returns the time taken to perform the last check in milliseconds. | RayCollision | ||
data : Vector.<CollisionInfo>
CollisionInfo-type vector with collision results. | RayCollision |
Method | Defined By | ||
---|---|---|---|
Creates a new RayCollision object. | RayCollision | ||
addCollisionWith(pivot:Pivot3D, includeChildren:Boolean = true):void
Adds objects that will be used to check for collisions. | RayCollision | ||
dispose():void | RayCollision | ||
removeCollisionWith(pivot:Pivot3D, includeChildren:Boolean = true):void
Removes a Pivot3D in order to stop its checking process. | RayCollision | ||
test(from:Vector3D, direction:Vector3D, getAllPolysUnderPoint:Boolean = false, ignoreInvisible:Boolean = true, ignoreBackFace:Boolean = true):Boolean
Performs the collision check. | RayCollision |
collided | property |
collided:Boolean
[read-only] Returns whether collision occurred or not in the last check.
public function get collided():Boolean
collisionCount | property |
collisionCount:int
[read-only] Returns the number of objects to be checked.
public function get collisionCount():int
collisionTime | property |
collisionTime:int
[read-only] Returns the time taken to perform the last check in milliseconds.
public function get collisionTime():int
data | property |
public var data:Vector.<CollisionInfo>
CollisionInfo-type vector with collision results.
RayCollision | () | Constructor |
public function RayCollision()
Creates a new RayCollision object.
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(from:Vector3D, direction:Vector3D, getAllPolysUnderPoint:Boolean = false, ignoreInvisible:Boolean = true, ignoreBackFace:Boolean = true):Boolean
Performs the collision check. Both the from parameter and the direction parameter must be in the global scene space. The direction parameter is a Vector3D that represents the direction the ray is pointing to, eg. ( 0, -1, 0 ) would be downward, ( 0, 0, 1 ) would be forward, etc.
Parameters
from:Vector3D — Point of origin of the ray.
| |
direction:Vector3D — Direction the ray points to.
| |
getAllPolysUnderPoint:Boolean (default = false ) — Defines whether all the collisions or only the first collision is to be taken.
| |
ignoreInvisible:Boolean (default = true )
| |
ignoreBackFace:Boolean (default = true )
|
Boolean — true if collision occurred.
|
See also