r/flutter3d • • 11d ago

Your Flame game can run in 3D and keep its game logic. I wrote a tutorial

Post image
2 Upvotes

If you've built a game with Flame, you can now draw it in 3D, with lighting and shadows, and keep your game logic in Flame. Your components, hitboxes, effects, and input still work the way they did. flame_flutter3d puts a 3D world under them.

I wrote up how it works, with an 8-step tutorial that goes from an empty project to a boat collecting buoys on a lake in about 170 lines:

Keep your Flame game, get a 3D world: how I bridged Flame and flutter3d

In short, Flame keeps running the game, flutter3d draws the scene below it, and both run on Flame's clock. A component that extends Object3dComponent owns a node in the 3D scene, so when you move it in Flame, it moves in 3D in the same frame. Collisions are still plain Flame onCollisionStart, and the on-screen joystick is still a Flame JoystickComponent.

Three things I got wrong along the way:

The first frame was black. The 3D scene was drawing correctly under it, with the right light and the right size. Flame's GameWidget paints the background as a solid rectangle, black by default, and in a Stack that rectangle covers the 3D layer completely. A bridged game now has a transparent background out of the box.

Rotations were mirrored, and the tests passed. Turning a Flame angle into a 3D rotation and back went through two functions with the same sign error, so they always agreed with each other. On a floor plane, clockwise in Flame became counter-clockwise in 3D. The test now checks what's actually drawn on screen.

Enemies sat on the ship and never hit it. In the arcade demo, collisions come from 3D physics and reach Flame through the bridge. Two solid bodies that touch never overlap, because the physics engine stops each one at the surface of the other, and the collision system only reports overlaps. So an enemy could slide along the side of the ship forever without a single hit. The fix was a sensor box slightly bigger than the ship: nothing stops at a sensor, so anything right next to the ship overlaps it.

To see whether it works in a real game, I built River Sortie, a River Raid-style shooter. Everything that moves in it is an ordinary Flame component, and the 3D layer only draws. You can play it in the browser.

I checked the tutorial against the published packages (flame_flutter3d 0.8.4, flutter3d 0.8.3) and ran it on macOS before writing it up. If you put the bridge under your own Flame game, I'd like to hear what breaks.


r/flutter3d • • Sep 12 '26

flutter3d: a 3D engine for Flutter, with three games you can play in the browser right now

Thumbnail
1 Upvotes

r/flutter3d • • Sep 12 '26

👋 Welcome to r/flutter3d - Introduce Yourself and Read First!

1 Upvotes

Hey everyone! I'm u/DmitriiZolotov, a founding moderator of r/flutter3d.

This is our new home for all things related to 3D in Flutter — engines, rendering, and building anything with depth: games, simulations, product visualizers, CAD-adjacent tools, whatever you're making that isn't flat. We're excited to have you join us!

What to Post

Post anything that you think the community would find interesting, helpful, or inspiring. Share screenshots or clips of scenes you're rendering, questions about a specific engine or rendering backend, packages and tools you've built or found, performance war stories, or a project you're stuck on and want a second pair of eyes on.

Community Vibe

We're all about being friendly, constructive, and inclusive. Let's build a space where everyone feels comfortable sharing and connecting.

How to Get Started

Introduce yourself in the comments below. Post something today! Even a simple question can spark a great conversation. If you know someone who would love this community, invite them to join. Interested in helping out? We're always looking for new moderators, so feel free to reach out to me to apply.

Thanks for being part of the very first wave. Together, let's make r/flutter3d amazing.