explaingit

swaggyliu/flatworld

Analysis updated 2026-05-18

18PythonAudience · developerComplexity · 4/5LicenseSetup · moderate

TLDR

A GPU-accelerated 2D and 3D physics engine combining finite element soft bodies, impulse-based rigid bodies, and batched contact across ground, height field, and voxel terrain.

Mindmap

mindmap
  root((FlatWorld))
    Soft bodies
      Explicit FEM
      Elastic and plastic materials
    Rigid bodies
      Ball box capsule mesh
      SAT and GJK
      Revolute and prismatic joints
    Ground types
      Plane domain
      Height field
      Voxel grid
    Tooling
      51 test files
      35 scene gallery
      NVIDIA Warp GPU

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Simulate soft body deformation with explicit FEM and elastic or plastic materials.

USE CASE 2

Simulate rigid body collisions and joints like revolute or prismatic connections.

USE CASE 3

Mix rigid and soft body contact against ground, height field, or voxel terrain.

USE CASE 4

Regenerate the rendered scene gallery to visually check simulation behavior.

What is it built with?

PythonNVIDIA WarpNumPySciPy

How does it compare?

swaggyliu/flatworld1038lab/comfyui-agnes-aiandyuneducated/resolve-ai
Stars181818
LanguagePythonPythonPython
Setup difficultymoderateeasyhard
Complexity4/52/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Uses NVIDIA Warp for GPU acceleration, so a compatible GPU setup helps get the full performance benefit.

In plain English

FlatWorld is a physics simulation engine for two dimensional, and to some extent three dimensional, rigid and soft body dynamics, accelerated using NVIDIA's Warp library. The README describes it as combining explicit finite element simulation for soft bodies with impulse-based rigid body physics, plus batched contact handling across mixed types of surfaces such as flat ground, height fields, and voxel grids. On the soft body side, it supports explicit dynamics with linear elastic, Neo-Hookean, and J2 plasticity material models. On the rigid body side, it handles balls, boxes, capsules, and mesh shapes, using standard collision detection algorithms called SAT and GJK, combined with a constraint solver known as PGS. It also implements several joint types: revolute, weld, prismatic, and spherical. A unified manager batches the finite element and mixed contact calculations together so they can run efficiently on the GPU. Getting started involves cloning the repository, installing the Python dependencies from a requirements file, and installing the package itself in editable mode. A short code example in the README shows building a small triangular mesh, attaching gravity and elastic material properties to it, adding a ground plane, and stepping the simulation forward sixty times using an explicit time stepping loop. The project ships 51 test files covering finite element behavior, rigid body contact, joints, friction, and every supported ground type, runnable headlessly for continuous integration or with a graphical display when one is available. A gallery of 35 rendered scenes, including a domino chain, a two dimensional robot arm, stacked boxes, and a pendulum, is included and can be regenerated locally with a capture script. FlatWorld depends on NVIDIA Warp, along with numpy, scipy, meshio, and a few other libraries for mesh and geometry handling. It is released under the Apache License 2.0, and the README notes this is an early step toward eventually building a two dimensional world model on top of the engine.

Copy-paste prompts

Prompt 1
Help me install FlatWorld and run the quick start example from the README.
Prompt 2
Show me how to add a rigid box and a soft FEM mesh to the same FlatWorld scene.
Prompt 3
Explain how to switch the ground domain in FlatWorld to a height field.
Prompt 4
Walk me through running FlatWorld's headless test suite for CI.

Frequently asked questions

What is flatworld?

A GPU-accelerated 2D and 3D physics engine combining finite element soft bodies, impulse-based rigid bodies, and batched contact across ground, height field, and voxel terrain.

What language is flatworld written in?

Mainly Python. The stack also includes Python, NVIDIA Warp, NumPy.

How hard is flatworld to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is flatworld for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.