Sets the sprite up for automatic collision using the built physics system. Sets the mode to use for physics. Once you have set a sprite to be controlled by physics you should use SetPosition and Angle sparingly as these will interrupt the physics motion of the sprite. You can also use the SetPhysicsVelocity and PhysicsAngularVelocity to change the speed and direction of a sprite, but again these will interfere with the physics motion of the sprite. If you wish to influence the position or rotation of a physics sprite you should use the force and torque (rotational force) functions where possible, these will maintain smooth physics motion.
The property lets you choose how the sprite should behave in the physics world. pmStatic means it will never move or rotate. pmDynamic means it will respond to all collisions and forces it encounters, including gravity and collisions with static objects. pmKinematic is a special case which can be thought of as a moving static body, it will not respond to collisions or forces and will continue at its specified velocity forever, but dynamic items will respond to it and effectively be pushed out of the way.
The physics shape used is determined by the Shape property, which must be called before this method and is expensive to change for circle and polygon shapes as they rebuild a shape from the pixels of the sprite's image.
Once you have set this property to determine the mode of the sprite, you cannot change it anymore, as the mode cannot be changed whilst the sprite is in the physics system. If you wish to change the mode of a sprite call PhysicsDelete, which will delete all its physics settings, then set this property with the new mode. But doing this too often will slow the system down.
All physics sprites should be world sprites (not fixed to the screen), unless TAgkScene.SetViewOffset is set to 0,0 in which case this doesn't matter. Otherwise debug shapes will not line up and sprites from different view spaces will not interact properly.
Copyright (c) 2012. All rights reserved.