AGK for Pascal
TAgkSprite.PhysicsCollision Method

Checks two sprites for a physics sprites.

class function PhysicsCollision(const Sprite1: TAgkSprite; const Sprite2: TAgkSprite; out Collision: TAgkPhysicsCollision): Boolean; static;
const Sprite1: TAgkSprite 
The sprite to check for physics collision with Sprite2. 
const Sprite2: TAgkSprite 
The sprite to check for physics collision with Sprite1. 
out Collision: TAgkPhysicsCollision 
returns location information about the collision. 
True if the two sprites overlap or False if not. 

This function doesn't do any calculation, it simply looks up the results of the last physics step to determine if the sprites currently overlap. If this function returns True you can use the Collision parameter to get the collision point. If there is more than one point of collision it is not known which point will be returned. You can check the sprite's contact list to get the full list of contact points (see TAgkPhysics.GetFirstContact). If this function returns False, the value of the Collision parameter is undefined. 

This function is affected by group and category settings.

Copyright (c) 2012. All rights reserved.