AGK for Pascal
TAgkSprite.AddShapePolygon Method

Adds a new polygon shape to the sprite, in addition to any it already has. These additional shapes only apply to physics sprites and must be added after a sprite has been set to use physics.

procedure AddShapePolygon(const NumPoints: Integer; const Index: Integer; const X: Single; const Y: Single);
const NumPoints: Integer 
The number of points to use in the polygon, min 2, max 12. 
const Index: Integer 
Index for points, so you can specify index 0, 1, 2 etc. 
const X: Single 
X coordinate for the specified point 
const Y: Single 
Y coordinate for the specified point 

The polygon is defined by a set of points (between 2 and 12) relative to the current sprite's offset. For example, a point of 0,0 would be centered on the sprite's offset point, any other value will be offset from this point. 

This will recalculate the sprite's mass and center of mass values.

Copyright (c) 2012. All rights reserved.