I'll build you a medieval battering ram as a fully procedural Three.js asset — complete with realistic PBR materials, working swing physics, and one-click export to GLB/OBJ/STL. Let me start by exploring the project structure.
Build uses plain vite build (no tsc step) and Tailwind v4. Let me check the remaining config files.
Now let me verify the GLTFExporter animation API to make sure the swing animation exports correctly into the GLB file.
Let me check the GLTFExporter source directly to confirm how it handles animation tracks.
The exporter source confirms everything I need: parseAsync with an animations option, QuaternionKeyframeTrack mapping to glTF rotation channels, bump map support, and WYSIWYG onlyVisible export. Now let me install the required packages.
Packages installed. Now I'll create the procedural texture module — this generates realistic wood grain, rusted iron, rope, leather, dirt, and dust textures on canvas (no external image files needed, and they embed cleanly into exported GLB files).
Textures module created. Now the geometry helpers — beam builder with realistic UV mapping (grain runs along the length), and a cylinder-between-points utility for ropes, straps, and braces.
Now the core of the project — the BatteringRam model class. This builds the entire siege engine procedurally: tapered oak ram log with forged iron cap, rope slings cradling it, timber truss frame, hide-covered mantlet roof, side pavises, 8-spoke wheels, and tow ropes — plus pendulum swing physics, frame recoil with rolling wheels, and dust impact particles.
I made a typo in a color value. Let me fix that.
I need to fix a few issues: the shield material mutates the shared roof texture's repeat (a bug), and there are two unused parameters. Let me refactor the material handling so each part gets its own texture instance.
Now let me declare the canvas fields and fix the shield/ram builder signatures.
Now let me fix the buildShields and buildRam signatures, and remove the duplicate field declaration.
Both fixes applied cleanly. Let me verify the material-preset section of the file is consistent now.
I want to improve the roof plank tiling (one tile stretched across 6.7m looks bad) and fix the preset swap for the shield/roof materials. Let me refine this.
The model file is now clean. Next, the Studio class — this wires up the Three.js scene, lighting, PBR environment, camera controls, animation loop, and all export logic (GLB with/without baked animation, OBJ, STL).
Two minor type issues to fix — an unused field and the STL DataView typing.
Studio is clean. Now let me create the "Use in your game" modal with Three.js integration code snippets.
Now the main App.tsx — the full studio UI: viewport, control panel with animation/parts/materials/export sections, export dropdown with toasts, and stats bar.
Let me fix the unused import and the React.ReactNode type reference.
Now let me update index.html with the proper title and medieval/technical fonts, plus the index.css with font setup and scrollbar styling.
Now let's build the project to verify everything compiles.
The build succeeds, but I caught a critical bug while reviewing: the ramSwing/ramAssembly groups are never added to the scene hierarchy — the ram would be invisible. Let me fix that.
Let me review the full model file to catch any other issues before finalizing.
Hierarchy looks correct. Let me verify the suspension, ram, and update sections.
The model looks solid. I spotted one lighting bug: both shield panels face +X — the left shield's normal points inward. Let me fix the orientation.
Let me rebuild to confirm everything still compiles.
The build works, but reviewing the swing physics, I realized the rigid-pendulum model tilts the log too much (front tip rises ~1.3m) — real slung rams translate forward while staying horizontal. Let me upgrade to the physically-correct translation model with dynamic sling straps that lean as the ram swings, and bake a full multi-track animation (ram translation + strap position/rotation/scale) for export.
Now let me add the dynamic strap fields and rewire the suspension to use them.
Now let me replace the static strap creation in buildSuspension with dynamic unit-length straps.
Now let me add the updateStraps method and rewrite the update/resetPose logic for the translation-based swing.
Now let me rewrite buildSwingClip to bake the complete animation — ram translation plus all four sling straps' position/rotation/scale keyframes.
Now let me update the code snippet in the modal to match the new translation-based swing, and sync the amplitude defaults.
I need to fix a double-offset bug: the ram's internal parts still use the old -ROPE_LENGTH local offset, but the assembly origin is now the log center. Let me correct the ram part positions and strap attach points.
Now let me fix the strap attach points and dust tip to match the new assembly origin.
Let me rebuild to verify all the physics changes compile.
Build passes. Let me do a final full review of the model file to make sure all geometry is coherent after the refactors.
Let me check the main.tsx entry point and verify the final file structure.
The setup is solid. One UI issue: on desktop the right-side control panel would cover the header's action buttons (same z-index, later in DOM). Let me shift the header buttons clear of the panel and reposition the interaction hint.
Let me search for any leftover references to the old rotation-based swing and verify the final state.
Everything is consistent. One small refinement — preserve the user's paused state across exports so exporting doesn't unexpectedly unpause the animation.
Now the final build to confirm everything is production-ready.
The Siege Ram Workshop is complete and builds successfully. Here's what I built for you:
🛡️ What it is
A full Three.js asset studio for a medieval battering ram — built 100% procedurally from primitives, so it exports cleanly with zero external files.
The model (7 toggleable parts)
- Ram log & cap — tapered oak trunk, 7 iron bands, forged cone cap with blunt tip, rear butt ring, leather wear pads
- Suspension slings — 4 rope slings cradling the log, hanger beam, diagonal hangers, iron shackles
- Timber frame — corner posts, top/lower beams, zig-zag trusses, end-wall braces, iron joint plates with bolts
- Mantlet roof — plank gable roof under semi-transparent leather hides, ridge beam with iron straps
- Side pavises — crew shields with cross bracing and stiles
- Wheels & axles — 8-spoke wheels with iron tires, hubs, cotter pins
- Tow ropes — drag ropes with rope coils
Realistic textures & materials
All PBR (metalness/roughness) with canvas-generated maps used as both color and bump: wood grain with knots/cracks, rusted iron with scratches/pitting, woven rope, mottled leather, dirt ground. Swap between 4 timber presets (Oak, Dark Oak, Ash, Weathered) and 3 iron presets (Wrought, Rusted, Bronze) live.
Realistic movements
- Pendulum swing — the log translates in a circular arc and stays horizontal (true slung-ram physics), with the sling straps re-targeted every frame so they stay taut
- Frame recoil + wheels that actually roll backward on impact
- Dust bursts at the strike, ACES tone mapping + RoomEnvironment studio reflections, soft shadows
Export (fully game-ready)
- GLB with baked animation — bakes the ram translation plus every sling strap's position/rotation/scale keyframes, so it plays back correctly in any engine
- GLB static, OBJ, STL — hidden parts are stripped from exports (WYSIWYG), textures embedded, authored in meters (~8.1 m long)
- A "Use in game" modal with copyable Three.js snippets: GLTFLoader loading, driving the swing yourself for gameplay, impact-point math, and export-from-code recipes
Files built: src/three/textures.ts, src/three/helpers.ts, src/three/BatteringRam.ts, src/three/Studio.ts, src/components/CodeModal.tsx, src/App.tsx, index.html, src/index.css