Type Function Library physics.* Return value none Revision Release 2024.3703 Keywords physics, draw mode, debug, hybrid See also physics.start()
Sets one of three possible “rendering modes” for the physics engine. While this feature will run on devices, it’s most useful in the Corona Simulator when testing/debugging physics behavior.
In "hybrid"
or "debug"
mode, physics data is displayed using colored vector graphics which reflect different object body types and attributes. See the Physics Bodies guide for details on body types.
Outline Color | Physical Type |
---|---|
orange | Dynamic physics bodies |
dark blue | Kinematic physics bodies |
green | Static, |
gray | Bodies which are “sleeping” due to lack of activity |
light blue | Physical joints |
When working with Corona display groups and Box2D, it’s important to remember that Box2D expects all physics objects to share a global coordinate system. Both grouped and ungrouped display objects will work well since they will share the internal coordinates of that group. However, unexpected results will occur if physical objects are added to different display groups and those groups are moved, scaled, or rotated independently of each other. As a general rule, do not alter the position, scale, or rotation of display groups that contain physics objects.
physics.setDrawMode( mode )
String. The draw mode, which can be any of the following:
"normal"
"hybrid"
"debug"
physics.setDrawMode( "normal" ) -- The default Corona renderer (no collision outlines) physics.setDrawMode( "hybrid" ) -- Overlays collision outlines on normal display objects physics.setDrawMode( "debug" ) -- Shows collision engine outlines only