class flixel.addons.tile.FlxRayCastTilemap extends FlxTilemap
Available on all platforms
@author greglieberman
Instance Fields
function rayCast(Start:FlxPoint, Direction:FlxPoint, ?Result:FlxPoint = null, ?ResultInTiles:FlxPoint = null, ?MaxTilesToCheck:Int = -1):Bool
Casts a ray from the start point until it hits either a filled tile, or the edge of the tilemap If the starting point is outside the bounding box of the tilemap, it will not cast the ray, and place the end point at the start point. Warning: If your ray is completely horizontal or vertical, make sure your x or y values are exactly zero. Otherwise you may suffer the wrath of floating point rounding error! Algorithm based on http://www.metanetsoftware.com/technique/tutorialB.html http://www.cse.yorku.ca/~amana/research/grid.pdf http://www.flipcode.com/archives/RaytracingTopicsTechniques-Part4Spatial_Subdivisions.shtml *
Start | The starting point of the ray * |
Direction | The direction to shoot the ray. Does not need to be normalized * |
Result | Where the resulting point is stored, in (x,y) coordinates * |
ResultInTiles | A point containing the tile that was hit, in tile coordinates (optional) * |
MaxTilesToCheck | The maximum number of tiles you want the ray to pass. -1 means go across the entire tilemap. Only change this if you know what you're doing! * |
returns | true if hit a filled tile, false if it hit the end of the tilemap |