Defold Learn logo


Box2D documentation

Functions for interacting with Box2D.

Version: alpha

FUNCTIONS
b2d.get_body() Get the Box2D body from a collision object
b2d.get_version() Get the Box2D version information for the active backend.
b2d.get_world() Get the Box2D world from the current collection

Functions

b2d.get_body()

b2d.get_body(url)

Get the Box2D body from a collision object

PARAMETERS

url string
hash
url
the url to the game object collision component

RETURNS

body b2Body
the body if successful. Otherwise nil.

b2d.get_version()

b2d.get_version()

Get the Box2D version information for the active backend.

PARAMETERS

None

RETURNS

info table
version info with fields version, major, middle, and minor

b2d.get_world()

b2d.get_world()

Get the Box2D world from the current collection

PARAMETERS

None

RETURNS

world b2World
the world if successful. Otherwise nil.