Physics and joints (DEF-3025) (SOLVED)

Are there any plans to adding joints into physics engine?
Just want to porting some old stuff from Flash to Defold such as:

9 Likes

There is currently no plan for this, but we’ve said that we want it many times :confused:
I added the ticket DEF-3025 for this.

7 Likes

So I can’t make a car physics. And it’s impossible to develop games like Earn to Die, Moto X3M, Hill Climb Racing, Happy Wheels etc…

3 Likes

Not impossible. For example, someone could make a Box2D native extension with all of the features.

It’s not an easy, because we have no access to buffers with game components like transform, physic shapes data etc.
For now it will have big overhead for communication like lua->NE->lua->Engine every frame.
It would be great if Defold developers made this buffers accessable using Defold SDK.


We do not even have possability to read vectors (user types: vector3, vector4, matrix etc) on NE side (using Defold SDK) but we talked about this with @Mathias_Westerdahl and I hope for a soon improvements here.

4 Likes

Car physics can be implemented in Lua, should not be too hard. Check out this javascript version, for instance: https://github.com/spacejack/carphysics2d

1 Like

It’s not exactly what @notbadgun meant. Moto X3M:

That is also possible, but takes more work, of course.

Here’s a unity version that looks nicer. It’s ported from the same physics code: https://github.com/jongallant/CarSimulator

Any news?
Currently Defold can’t be used to remake any physics Flash games.

2 Likes

No news. We still want to improve the Box2D support, but other things have been given higher priority.

We do also plan to move Box2D and Bullet into native extensions. That way developers can fork and expose more parts of the API (although without nice editor bindings).

For now, an alternative would be to use your own physics extension. I started a Chipmunk2D extension a while back, but it’s not finished yet:

Forum post: Box2d update
HTML5 demo: https://britzl.github.io/Chipmunk2D

Note that this extension doesn’t give you any editor integration so you need to set things up via code. I wonder if there’s some external tool to create complex physics objects with bodies, joints, springs etc?

What kind of joints would you say are the most important to implement first?

4 Likes

There’s this https://www.iforce2d.net/rube/ http://www.iforce2d.net/forums/viewtopic.php?f=6&t=240

Yes, that’s exactly the kind of tool I was thinking of. And it has a simple json file format!

1 Like

So awesome!

It’s okay! But is it possible to get shapes of collision objects via code as I see them in editor?

For games like Mining Truck the most important are b2RevoluteJoint and b2PrismaticJoint (Box2D naming).

1 Like

No, you need to create everything through code. You cannot set anything up in the editor. And the extension maps the Chipmunk API, nothing more. You can however build a Lua wrapper on top of it that binds the created Chipmunk bodies to game objects and keeps them automatically update (like dynamic collision objects in Defold). This is what I do in the example.

I believe both of these have Chipmunk 2D equivalents.

1 Like

photo_2019-02-14_15-23-56

from https://www.defold.com/technology/

1 Like

Hi, so the Box2D was fully integrated finally or not? With joints and all?

2 Likes

No, not yet.

1 Like

Solved in 1.2.156

6 Likes