AGK for Pascal
TAgkPhysics.SpriteRayCastSingle Method (TAgkSprite, TAgkPoint, TAgkPoint)

Casts a ray through a particular sprite (can be physics or non physics) and stores the result of any intersection.

class function SpriteRayCastSingle(const Sprite: TAgkSprite; const P1: TAgkPoint; const P2: TAgkPoint): Boolean; overload; static;
const Sprite: TAgkSprite 
The sprite to check for intersection with the ray. 
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 or properties such as RayCastNormal. If the ray starts inside a shape that shape will not be counted in the results. This function is special in that it also works on all sprites even those that do not have physics turned on, but the sprite must have been assigned a shape using one of the sprite shape commands.

Copyright (c) 2012. All rights reserved.