blog

here's what i'm working on

Importing Blender scenes into Godot

March 03, 2022 — ~kai

Blender often used for creating scenes and 3d models, and Godot is an engine for developing games. Naturally, these two programs can work side by side.


Export the Blender scene using the glb format. Suppose you created house.glb.

In Godot, use the First Person Starter template (downloadable from new project). You will notice that the starting scene is res://Levels/Main/L_Main.tscn. Create a folder structure under res:// called Models/House/. Drag and drop your house.glb file into /Mod els/House, this is where you will keep the imported glb.

Right click on house.glb and click New Inherited Scene. This will create a Godot-compatible scene house.tscn derived from the house.glb file. Perhaps rename it to housegd.tscn and move it to res://Models/.

Locate /Levels/Main/L_Main.tscn, right click, Open Scene. Drag and drop housegd.tscn from the FileSystem pane to L_Main in the Scene pane just above it. This puts it into L_Main, however, many parts of the scene are not collidable.

Right click housegd in the Scene pane and press Open In Editor (or click the icon next to the castlegd text). Find the Mesh that you want to make collidable, like a wall.

If the Mesh is relatively simple: Select the Mesh button at the top of the viewport and choose Create Trimesh Static Body. This will a utomagically create a StaticBody with a CollisionShape child for your Mesh.

If the Mesh is complex: Select the Mesh button at the top of the viewport and choose Create Single Convex Collision Sibling. Right click, add child node (Ctrl+A) StaticBody, and move the CollisionShape to be a child of StaticBody.

Use Ctrl+S to save your scene and return to L_Main using the tab at the top. Use Ctrl+S to save this scene and press the Play button at the top right of the screen.

tags: art