2D Physics, 3D Art (Like Trine)

Godot Version

4.3.stable

Question

What is a good way to have a game’s physics be handled entirely by the 2D physics engine, while using 3D art?

The Trine series of games is a good example of what I’m thinking of.

Since I’m coming from Unity, here’s what I’m used to: 2D and 3D both share the same “world”. You attach a 3D mesh renderer component and a 2D physics component to an object. Since they both render in the same view, and use the same transform, there is no further work to have a 3D object move around with 2D physics.

However, in Godot, it seems like 2D and 3D worlds are completely separate and require a lot of manual synchronization. Editing the scene seems like it might require custom tooling as well, since game logic/physics would be in one tab (2D), and visuals would be in the other (3D). This separation would make level editing quite awkward and clunky. (Not being able to see collisions in 3D when editing the 3D art, and vice versa.)

I’m aware that I could use the 3D physics engine and restrict depth/XY rotation, but I’m really hoping to be able to use the simpler 2D physics engine (and tooling, like the 2D polygon collision nodes).

You would do it all in 3d. locking the z axis for your physics objects. And with the z axis locked you get 2d physics. And there is 3d poly collisions too. Which is restricted to 2d in a way. You draw a shape and set a depth.

I’m working on a few projects just like this. It’s trivial to setup.

You could render a 3d mesh into the 2d world too. Just need to setup subviewports to write into the canvas. In this sense it would become an animated sprite that you would setup your 2d character underneath it.

1 Like

Yeah after messing with it, it seems like this is the path of least resistance. A bit unwieldy to have to use the entire 3D physics system, but short of writing a bunch of stuff to sync both “worlds”, I can’t think of another way. That’s Godot for you, I guess.
Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.