Skip to content

d954mas/defold-box2d

Repository files navigation

Box2D for Defold

Box2D lua bindings for the Defold Game Engine.

I tried to keep the lua api the same as the c++ api when possible.

If you like the extension you can support me on patreon. It will help me make more items for defold.

"Buy Me A Coffee"

Try the demo: https://d954mas.github.io/defold-box2d/

Table of Contents

Installation

1) Add defold-box2d in your own project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

Defold >=1.8.0

https://github.com/d954mas/defold-box2d/archive/refs/tags/1.0.3.zip

Defold < 1.8.0

https://github.com/d954mas/defold-box2d/archive/refs/tags/1.0.2.zip

⚠️ This extension removes default box2d, that means you have to remove all the Collision Object components from your collections and Game Objects

API

Supports emmylua. box2d_header.lua

Box2D

If you need info about how Box2D works, read its documentation. https://box2d.org/documentation/

Box2d version: 2.4.1

Limitations

1) No binding for b2Vec2. Use defold vector(vmath.vector3)

2) No binding for some b2World functions.

void SetContactFilter(b2ContactFilter* filter);
const b2ContactManager& GetContactManager() const;

3) No binding for some b2Joint functions.

virtual void Draw(b2Draw* draw) const;