Skip to content
bartteunis edited this page Aug 11, 2024 · 11 revisions

Blender Rigidbody Exporter

This plugin exports the rigidbody world from a Blender scene. It exports to a JSON-based format that closely resembles the structure of the bpy API.

The main goal of this plugin is to have a straightforward and easy-to-use way to export 2D collision shapes for use in GameMaker.

World info

The plugin exports the scene's gravity as found under Scene > Gravity.

The general simulation parameters found under Scene > Rigid Body World are also exported. These are: time scale, steps per second and solver iterations.

Collision shapes

Mesh

The mesh is the most versatile collision shape and allows several face loops in a single mesh instance (great for static scenery/masks).

What actually gets exported in this case are loop cycles.

Mesh collision shapes are always exported as edge/chain shapes.

More complex shapes

Some models have a very complex shape. The requirement for a polygon shape is that it should be convex. For a more complex concave shape this can be solved by using Mesh > Clean up > Split Concave FacesThis may result in polygon shapes with >8 points. The plugin shows a warning message when this is the case.

Before Mesh Clean-Up

After Mesh Clean-Up

Convex Hull

The convex hull shape generates a new mesh shape that surrounds the mesh while being convex in shape. To achieve this, the plugin first makes a copy of the current mesh and applies the Vertices> Convex Hull operator on it, then cuts the vertices using Tools > Knife Project with the Cut Through option enabled.

This shape is eventually converted to a mesh shape that is exported as a convex polygon fixture with at most 8 vertices.

Cone, Cylinder, Capsule, Sphere

These all map to a circle shape in 2D.

Box

Corresponds to a box shape in 2D.

Box Shape

Constraints

These correspond to joints in GameMaker.

  • Fixed - Not really an equivalent joint in GM (Weld joint?)
  • Hinge/Point - Revolute joint
  • Slider - No equivalent
  • Piston - Prismatic