×
A new build of Corona SDK is now available to subscribers. Not a subscriber? Subscribe now.
CoronaSDK 2014.2438 | Released: 17 Sep 2014, 5:10pm | What's New | Download Now

physics.setDrawMode()

Description:

Selects one of three possible rendering modes for the physics engine. This mode may be changed at any time -- see the "DebugDraw" sample project for an example of how to toggle it on the fly.

While this feature will also run on devices, it will probably be most useful in the Corona Simulator, when debugging unexpected physics engine behavior.

Syntax:

physics.setDrawMode( mode )

Example:

physics.setDrawMode( "debug" ) -- shows collision engine outlines only
physics.setDrawMode( "hybrid" ) -- overlays collision outlines on normal Corona objects
physics.setDrawMode( "normal" ) -- the default Corona renderer, with no collision outlines

Parameters:

mode
Rendering modes: "debug", "hybrid", or "normal"

Returns:

Nothing.

Remarks:

The physics data is displayed using color-coded vector graphics, which reflect different object types and attributes:

* Orange: dynamic physics bodies (the default body type)
* Dark blue: kinematic physics bodies
* Green: static physics bodies, such as the ground or walls
* Gray: a body that is "sleeping" due to lack of activity
* Light blue: joints

NOTE: While the physics debug draw renderer should correctly account for physics objects in nested display groups, it will display misleading results if display groups are rotated or scaled. This will be addressed in a future release.

Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    Corona SDK 2.0
  • Windows:
    Corona SDK 2.0
  • iOS:
    Corona SDK 2.0
  • Android:
    Corona SDK 2.0