AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.SetPhysicsCenterOfMass Method (Single, Single)

Sets the center of mass (COM) realtive to the sprite's offset.

Syntax
Pascal
procedure SetPhysicsCenterOfMass(const X: Single; const Y: Single); overload;
Parameters 
Description 
const X: Single 
The X coordinate of the center of mass. 
const Y: Single 
The Y coordinate of the center of mass. 

By default the AGK calulates the best location for the COM based on the size and location of all shapes attached to the sprite. Setting it to 0,0 will put the COM on the sprite's offset point (and center of rotation). If the COM is very different from the offset point the sprite may seem unstable as it will behave like an unbalanced spinning top.

Copyright (c) 2012. All rights reserved.