createHeightSampler for React: a height function is used as-is, a mesh or group (e.g. from a ref callback) is baked once, and again only when terrain or maxResolution changes. No terrain: flat ground at 0.
ref
terrain
maxResolution
Optional
const [ground, setGround] = useState<Object3D | null>(null)const sample = useHeightSampler(ground, 512)return <mesh ref={setGround} geometry={terrain} /> Copy
const [ground, setGround] = useState<Object3D | null>(null)const sample = useHeightSampler(ground, 512)return <mesh ref={setGround} geometry={terrain} />
createHeightSampler for React: a height function is used as-is, a mesh or group (e.g. from a
refcallback) is baked once, and again only whenterrainormaxResolutionchanges. No terrain: flat ground at 0.