AGK for Pascal
TAgkPhysics.RayCastCategory Method (Cardinal, TAgkPoint, TAgkPoint)

Casts a ray through all physics objects including sprites that have physics turned on and stores the closest item hit.

class function RayCastCategory(const Categories: Cardinal; const P1: TAgkPoint; const P2: TAgkPoint): Boolean; overload; static;
const Categories: Cardinal 
The categories to check for intersection with the ray, bitwise field using the lower most 16 bits. 
const P1: TAgkPoint 
The start point in world coordinates. 
const P2: TAgkPoint 
The end point in world coordinates. 

True if there was a collision, False if not.

Results of a ray cast can be retrieved using the other ray cast functions and properties such as RayCastNormal

If the ray starts inside a shape that shape will not be counted in the results. 

This function filters the sprites that are checked so only sprites of certain categories are checked. The category parameter is a bitwise field that uses the lower 16 bits to represent each of the possible 16 categories used when setting up a sprite. The default value of all 1s means all categories will be included, whereas a value of all 0s means no categories will be included. You can set individual bits to set which ones should be checked.

Copyright (c) 2012. All rights reserved.