AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.SetPhysicsForce Method

Applies a force to the sprite that will last for this frame only, to continue applying this force you must keep calling this function.

Syntax
Pascal
procedure SetPhysicsForce(const X: Single; const Y: Single; const VX: Single; const VY: Single);
Parameters 
Description 
const X: Single 
The X coordinate of the force position in world coordinates. 
const Y: Single 
The Y coordinate of the force position in world coordinates. 
const VX: Single 
The X component of the force direction. 
const VY: Single 
The Y component of the force direction. 

The force consists of a point in world coordinates and a direction, if the point and direction are not in line with the sprite's offset point then it will result in a rotation of the sprite as it is moved by the force. The length of the force vector determines its strength. If the sprite is constrained by surrounding objects it may not move unless the force is large enough to move those objects as well. 

Forces apply acceleration to an object relative to its mass, heavy objects will move less than light objects with the same force applied to them.

Copyright (c) 2012. All rights reserved.