A door is not a mesh — interactive doors and walkable interiors
Devlog #4 — continuação de #3. Houses you can't enter are wallpaper. This week our village gained interiors you can actually walk into — and the door, the smallest piece of it, turned out to be the most interesting engineering.
A door is not a mesh
The naive approach: place a door-shaped mesh in the doorway. Congratulations, you have a wall that looks like a door. A real door is a composition: an invisible trigger volume sitting in the doorway gap (<invisivel><porta><atravessa><vao:46>) plus a procedurally generated leaf mesh mounted onto it through our socket/plug system. The leaf is a separate object — it can swing, be replaced, be hidden — while the trigger owns the logic.
The hinge problem
A door rotating around its center looks broken instantly — real doors swing on a hinge. Our fix is one number: socketdx=-23 offsets the mesh pivot to the door jamb, so the 95° swing arcs around the frame edge exactly like a real leaf. Cheap, correct, invisible when done right.
The editor knows what a doorway is
Dragging a door prefab near a wall, the editor searches for a one-cell gap in the collision grid (InteriorDoorSnap), centers the door in it and writes the rotation automatically — 0° for horizontal walls, 90° for vertical. No manual alignment, no crooked doors.
The rules that make it feel alive
- F toggles — the player chooses to open doors. Deliberately: walking through a doorway should be a decision, not an accident.
- NPCs auto-open by proximity — the village stays alive; villagers don't get stuck on their own doors.
- Auto-close after ~90 ticks — unless you opened it yourself. The world tidies up behind NPCs but respects the player's state.
- <tranca> needs a key, <selada> never opens — locked and sealed variants for level design, same prefab.
Collision that breathes
The doorway cells become dynamic blocking only while the door is less than half open (Open < .5). A closing door pushes back; an open one is simply gone. No invisible walls, no walking through closed doors.
Inside, the camera changes its mind
Exteriors and interiors want different cameras. When the player crosses into a zone authored as interior (int_*), the roof overhead fades to transparency — and walls that block the view don't vanish, they dissolve through an ordered Bayer dither pattern, so you always read the building's shape while seeing your character. The building stops being a shell and becomes a place.
Why this matters
Every RPG player knows the disappointment of a beautiful village of sealed cardboard houses. Interiors are where a world becomes honest — and they start at the door, the exact point where outside becomes inside. Next up: multi-floor habitability, because a door is only half the story when a house has stairs.
🌐 https://i3azres.com (PT/EN/中文/日本語) — try the procedural village playground while you're there. A small Brazilian team's record of building an engine. Follow the project to watch it happen.