Geometry · interface
TreeParams
Procedural trees from parameters and a seeded RNG.
Explained in Hello world, Meshes and geometry.
interface TreeParamsimport type { TreeParams } from '@driftengine/core';In depth
Game-agnostic: it takes numbers and a random source and knows nothing about days, palettes or where a tree is going to stand.
The geometry comes back in two pieces, and the split is structural rather than a convenience. The trunk is solid — merged into static world geometry and paired with a collider, so it must never deform, or it would visibly separate from the thing you collide with. The canopy is flexible — drawn as instanced scatter that bends in the wind, which merging into the static world would make impossible. A tree that is one mesh can be collidable or animated, not both.
Properties
| Name | Type | Description |
|---|---|---|
height | number | |
trunkRadius | number | |
taper | number | How much narrower the trunk is at the top, 0..1. |
canopyRadius | number | |
canopyClusters | number | |
trunkColor | Vec3 | |
canopyColor | Vec3 |