There are certain behavioral aspects and limitations which should be noted when using physics. This guide outlines the most important and common among these.
Display objects with physical bodies can, of course, be placed in different display groups for
It is valid to move, scale, or rotate a series of groups in unison or
This also applies to the physics.setDrawMode()
"debug" modes — even though these draw modes will suggest that the bodies have changed as a result of modifying the group, the collision system will still consider them to be in their original state.
Display objects with physical bodies should generally not be scaled via object:scale(), object.xScale, or object.yScale. This is because the physics engine will still consider the physical body as it was originally defined. Essentially, if you scale the object up or down, the display object portion will visually reflect the applied scale, but the physical body will not be affected.
Display objects with physical bodies can be moved via transitions, but it's important to understand that these transitional movements function independently of physical movements. Thus, using transitional movement on physical objects should be handled carefully or avoided entirely.
For example, if a physical object is falling under the effect of simulated gravity, and then you apply a transition to a specific vertical point in the upward direction, the object's actual
Transitional movement can still be used on physical bodies, but you should ensure that there is no competing physical force or velocity on the object at the time the transition begins. One way to achieve this is by putting the body to sleep via
object.isAwake = false
If physical interaction occurs at any point during the transition — collision with another object, for example — you should immediately cancel the transition via transition.cancel() to prevent any further conflict between the two systems attempting to control the object.
Generally, you should avoid using any type of transitional movement or rotation upon a physical structure that consists of several distinct bodies attached by physical joints. If you apply a transition to just one of the bodies, the objects joined to that body may be incapable of maintaining synchronization with the transition occuring on the single body. This is especially true if the transition results in a fast or sudden shift in position or angle.