timelinefx:timelinefx.CheckRayCollision
Function CheckRayCollision:tlCollisionResult( target:tlBox, px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float=0 )
See if a ray collides with a boundary You can use this to test for a collision with a ray and any type of boundary: tlBox, tlCircle, tlLine and tlPolygon. Pass the origin of the ray with px and py, and set the direction of the raycast with dx and dy vector. dx and dy will be normalised and extended infinitely if maxdistance equals 0 (default), otherwise set maxdistance to how ever far you want the ray to extend to before stopping. If the ray starts inside the poly then result.RayOriginInside will be set to true. You can find the angle of reflection to bounce the ray using ReboundVector.
Parameters
target tlBox you're checking against
px x origin of the ray
py y origin of the ray
dx x direction of the ray
dy y direction of the ray
maxdistance maximum distance of the ray, or 0 for inifinate