Supagames

Physics Sandbox

Fracture Forest

A relaxing, physics-driven woodcutting simulator with procedural trees and real-time mesh slicing.

Unlimited Trees Destructible Meshes 100% Physics
Loading Forest...
Score: 0

Fracture Forest

Drag your mouse across the tree to slice it into pieces!

Drag Slice Wood Right-Click Drag Move Camera

Developer Log: Building Fracture Forest

Welcome to the mystical Fracture Forest! This project serves as a technology demonstrator for advanced Constructive Solid Geometry (CSG) techniques applied in real-time within a web browser. The goal was simple but technically challenging: create a relaxing, Zelda-inspired woodcutting game where every single slice dynamically cuts the 3D meshes and physically accurate fragments fall to the ground.

Controls & Scoring

Use your mouse to drag a slice plane across the procedural tree models to cut them into pieces. Every successful slice awards you 10 points. Chop the tree into as many small fragments as possible before gravity claims them.

1. Dynamic Mesh Slicing (CSG)

At the core of the game lies the three-bvh-csg library. Traditional games use pre-fractured meshes for destruction, swapping a whole object for its broken parts upon impact. In Fracture Forest, there are no pre-made pieces. When you swipe your mouse, the game calculates a mathematical plane from the camera through your cursor positions. It then performs a boolean subtraction and intersection operation in real-time, effectively creating two entirely new, dynamically sealed 3D meshes out of the original branch.

2. 100% Rigid Body Physics

Once a branch is sliced, its new geometric bounding box and center of mass are computed. The game leverages Cannon-es for physics simulation. Each wood fragment is instantly assigned a convex polyhedron physics body matching its newly sliced shape. The force and angle of your mouse swipe are converted into physical impulses, sending the fragments flying realistically according to their volume and weight.

3. Procedural Foliage Management

One of the biggest hurdles was the leaves. Passing highly complex foliage meshes through a CSG operation would freeze the browser. To solve this, Fracture Forest uses a custom "Foliage Partitioning" algorithm. The leaves are rendered as a single instanced-like buffer geometry. Upon slicing a branch, the algorithm iterates through all leaf triangles, calculates their distance to the centers of the newly created wood fragments, and dynamically splits the geometry array, assigning the correct leaves to the falling branch pieces. This ensures that when a branch falls, its leaves fall with it, without killing the frame rate!

4. Audio & Optimization

All sound effects (chopping, thuds, rustling leaves) are generated procedurally using the Web Audio API—no external sound files are loaded. Furthermore, collision listeners detect when fragments hit the ground to trigger these sounds and visual dust particles dynamically. The engine limits the maximum number of physical bodies and cleans up small splinters to maintain a buttery smooth 60 FPS.