wallhammer-web 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -2
  3. package/dist/base/data.d.ts +67 -0
  4. package/dist/base/data.js +10 -0
  5. package/dist/base/destructible.d.ts +167 -0
  6. package/dist/base/destructible.js +47 -0
  7. package/dist/base/env-slot.d.ts +101 -0
  8. package/dist/base/env-slot.js +8 -0
  9. package/dist/base/frames.d.ts +138 -0
  10. package/dist/base/frames.js +459 -0
  11. package/dist/base/index.d.ts +21 -0
  12. package/dist/base/index.js +11 -0
  13. package/dist/base/mat34.d.ts +46 -0
  14. package/dist/base/mat34.js +173 -0
  15. package/dist/base/material.d.ts +87 -0
  16. package/dist/base/material.js +6 -0
  17. package/dist/base/math.d.ts +27 -0
  18. package/dist/base/math.js +60 -0
  19. package/dist/base/progress.d.ts +38 -0
  20. package/dist/base/progress.js +81 -0
  21. package/dist/base/rig.d.ts +177 -0
  22. package/dist/base/rig.js +97 -0
  23. package/dist/base/trig.d.ts +29 -0
  24. package/dist/base/trig.js +169 -0
  25. package/dist/base/up.d.ts +26 -0
  26. package/dist/base/up.js +40 -0
  27. package/dist/base/view.d.ts +128 -0
  28. package/dist/base/view.js +136 -0
  29. package/dist/camera/camera.d.ts +99 -0
  30. package/dist/camera/camera.js +228 -0
  31. package/dist/camera/follow.d.ts +120 -0
  32. package/dist/camera/follow.js +320 -0
  33. package/dist/camera/free.d.ts +153 -0
  34. package/dist/camera/free.js +359 -0
  35. package/dist/camera/index.d.ts +10 -0
  36. package/dist/camera/index.js +6 -0
  37. package/dist/camera/orbit.d.ts +93 -0
  38. package/dist/camera/orbit.js +261 -0
  39. package/dist/camera/path.d.ts +48 -0
  40. package/dist/camera/path.js +179 -0
  41. package/dist/core/ballistic.d.ts +66 -0
  42. package/dist/core/ballistic.js +104 -0
  43. package/dist/core/bodies.d.ts +77 -0
  44. package/dist/core/bodies.js +125 -0
  45. package/dist/core/clock.d.ts +37 -0
  46. package/dist/core/clock.js +87 -0
  47. package/dist/core/cover-fade.d.ts +14 -0
  48. package/dist/core/cover-fade.js +38 -0
  49. package/dist/core/index.d.ts +13 -0
  50. package/dist/core/index.js +8 -0
  51. package/dist/core/kepler.d.ts +74 -0
  52. package/dist/core/kepler.js +108 -0
  53. package/dist/core/level-fade.d.ts +66 -0
  54. package/dist/core/level-fade.js +123 -0
  55. package/dist/core/palette.d.ts +15 -0
  56. package/dist/core/palette.js +47 -0
  57. package/dist/env/atmosphere.d.ts +129 -0
  58. package/dist/env/atmosphere.js +707 -0
  59. package/dist/env/cloud-field.d.ts +44 -0
  60. package/dist/env/cloud-field.js +111 -0
  61. package/dist/env/environment.d.ts +217 -0
  62. package/dist/env/environment.js +441 -0
  63. package/dist/env/frame-block.d.ts +29 -0
  64. package/dist/env/frame-block.js +152 -0
  65. package/dist/env/glsl.d.ts +35 -0
  66. package/dist/env/glsl.js +246 -0
  67. package/dist/env/index.d.ts +13 -0
  68. package/dist/env/index.js +9 -0
  69. package/dist/env/sky.d.ts +48 -0
  70. package/dist/env/sky.js +227 -0
  71. package/dist/env/sun.d.ts +31 -0
  72. package/dist/env/sun.js +42 -0
  73. package/dist/gen-arch/build.d.ts +17 -0
  74. package/dist/gen-arch/build.js +414 -0
  75. package/dist/gen-arch/damage/damaged.d.ts +44 -0
  76. package/dist/gen-arch/damage/damaged.js +1119 -0
  77. package/dist/gen-arch/damage/fall-material.d.ts +10 -0
  78. package/dist/gen-arch/damage/fall-material.js +47 -0
  79. package/dist/gen-arch/damage/fall.d.ts +78 -0
  80. package/dist/gen-arch/damage/fall.js +797 -0
  81. package/dist/gen-arch/damage/rubble.d.ts +22 -0
  82. package/dist/gen-arch/damage/rubble.js +188 -0
  83. package/dist/gen-arch/index.d.ts +25 -0
  84. package/dist/gen-arch/index.js +16 -0
  85. package/dist/gen-arch/interior/interior-plan.d.ts +114 -0
  86. package/dist/gen-arch/interior/interior-plan.js +615 -0
  87. package/dist/gen-arch/interior/interior.d.ts +97 -0
  88. package/dist/gen-arch/interior/interior.js +966 -0
  89. package/dist/gen-arch/structure/building-shader.d.ts +25 -0
  90. package/dist/gen-arch/structure/building-shader.js +946 -0
  91. package/dist/gen-arch/structure/buildings.d.ts +248 -0
  92. package/dist/gen-arch/structure/buildings.js +294 -0
  93. package/dist/gen-arch/structure/dims.d.ts +77 -0
  94. package/dist/gen-arch/structure/dims.js +39 -0
  95. package/dist/gen-arch/structure/distant.d.ts +62 -0
  96. package/dist/gen-arch/structure/distant.js +316 -0
  97. package/dist/gen-arch/structure/env-slots.d.ts +18 -0
  98. package/dist/gen-arch/structure/env-slots.js +47 -0
  99. package/dist/gen-arch/structure/facade.d.ts +193 -0
  100. package/dist/gen-arch/structure/facade.js +159 -0
  101. package/dist/gen-arch/structure/parts.d.ts +31 -0
  102. package/dist/gen-arch/structure/parts.js +69 -0
  103. package/dist/gen-arch/structure/roof.d.ts +76 -0
  104. package/dist/gen-arch/structure/roof.js +568 -0
  105. package/dist/gen-arch/structure/structure-material.d.ts +23 -0
  106. package/dist/gen-arch/structure/structure-material.js +55 -0
  107. package/dist/gen-arch/structure/writer.d.ts +94 -0
  108. package/dist/gen-arch/structure/writer.js +195 -0
  109. package/dist/gen-core/cell.d.ts +138 -0
  110. package/dist/gen-core/cell.js +150 -0
  111. package/dist/gen-core/cube-sphere.d.ts +57 -0
  112. package/dist/gen-core/cube-sphere.js +159 -0
  113. package/dist/gen-core/field.d.ts +55 -0
  114. package/dist/gen-core/field.js +154 -0
  115. package/dist/gen-core/geometry.d.ts +31 -0
  116. package/dist/gen-core/geometry.js +231 -0
  117. package/dist/gen-core/hash.d.ts +18 -0
  118. package/dist/gen-core/hash.js +58 -0
  119. package/dist/gen-core/height-field.d.ts +33 -0
  120. package/dist/gen-core/height-field.js +137 -0
  121. package/dist/gen-core/index.d.ts +22 -0
  122. package/dist/gen-core/index.js +17 -0
  123. package/dist/gen-core/instance-cells.d.ts +37 -0
  124. package/dist/gen-core/instance-cells.js +72 -0
  125. package/dist/gen-core/near-scatter.d.ts +56 -0
  126. package/dist/gen-core/near-scatter.js +120 -0
  127. package/dist/gen-core/noise.d.ts +23 -0
  128. package/dist/gen-core/noise.js +72 -0
  129. package/dist/gen-core/occupancy.d.ts +21 -0
  130. package/dist/gen-core/occupancy.js +104 -0
  131. package/dist/gen-core/sphere-patch.d.ts +138 -0
  132. package/dist/gen-core/sphere-patch.js +544 -0
  133. package/dist/gen-core/strip-surface.d.ts +34 -0
  134. package/dist/gen-core/strip-surface.js +246 -0
  135. package/dist/gen-core/strip.d.ts +102 -0
  136. package/dist/gen-core/strip.js +817 -0
  137. package/dist/gen-ground/env-slots.d.ts +48 -0
  138. package/dist/gen-ground/env-slots.js +78 -0
  139. package/dist/gen-ground/ground.d.ts +78 -0
  140. package/dist/gen-ground/ground.js +208 -0
  141. package/dist/gen-ground/index.d.ts +9 -0
  142. package/dist/gen-ground/index.js +7 -0
  143. package/dist/gen-ground/markings.d.ts +46 -0
  144. package/dist/gen-ground/markings.js +124 -0
  145. package/dist/gen-ground/materials.d.ts +18 -0
  146. package/dist/gen-ground/materials.js +22 -0
  147. package/dist/gen-ground/terrain-shader.d.ts +5 -0
  148. package/dist/gen-ground/terrain-shader.js +151 -0
  149. package/dist/gen-mesh/bare-shapes.d.ts +194 -0
  150. package/dist/gen-mesh/bare-shapes.js +596 -0
  151. package/dist/gen-mesh/bisect-surface.d.ts +47 -0
  152. package/dist/gen-mesh/bisect-surface.js +261 -0
  153. package/dist/gen-mesh/box.d.ts +18 -0
  154. package/dist/gen-mesh/box.js +2 -0
  155. package/dist/gen-mesh/cell-morph-mesh.d.ts +52 -0
  156. package/dist/gen-mesh/cell-morph-mesh.js +258 -0
  157. package/dist/gen-mesh/cell-surface-mesh.d.ts +32 -0
  158. package/dist/gen-mesh/cell-surface-mesh.js +140 -0
  159. package/dist/gen-mesh/chunk-mesh.d.ts +25 -0
  160. package/dist/gen-mesh/chunk-mesh.js +112 -0
  161. package/dist/gen-mesh/drape-mesh.d.ts +36 -0
  162. package/dist/gen-mesh/drape-mesh.js +98 -0
  163. package/dist/gen-mesh/height-field-mesh.d.ts +14 -0
  164. package/dist/gen-mesh/height-field-mesh.js +98 -0
  165. package/dist/gen-mesh/index.d.ts +26 -0
  166. package/dist/gen-mesh/index.js +15 -0
  167. package/dist/gen-mesh/line-mesh.d.ts +25 -0
  168. package/dist/gen-mesh/line-mesh.js +62 -0
  169. package/dist/gen-mesh/mesh-builder.d.ts +115 -0
  170. package/dist/gen-mesh/mesh-builder.js +315 -0
  171. package/dist/gen-mesh/packed-mesh.d.ts +53 -0
  172. package/dist/gen-mesh/packed-mesh.js +205 -0
  173. package/dist/gen-mesh/prism-mesh.d.ts +33 -0
  174. package/dist/gen-mesh/prism-mesh.js +176 -0
  175. package/dist/gen-mesh/rig-mesh.d.ts +9 -0
  176. package/dist/gen-mesh/rig-mesh.js +135 -0
  177. package/dist/gen-mesh/strip-mesh.d.ts +45 -0
  178. package/dist/gen-mesh/strip-mesh.js +258 -0
  179. package/dist/gen-plan/drain.d.ts +58 -0
  180. package/dist/gen-plan/drain.js +270 -0
  181. package/dist/gen-plan/grid.d.ts +37 -0
  182. package/dist/gen-plan/grid.js +182 -0
  183. package/dist/gen-plan/horizon.d.ts +50 -0
  184. package/dist/gen-plan/horizon.js +185 -0
  185. package/dist/gen-plan/index.d.ts +15 -0
  186. package/dist/gen-plan/index.js +13 -0
  187. package/dist/gen-plan/line-tiles.d.ts +35 -0
  188. package/dist/gen-plan/line-tiles.js +190 -0
  189. package/dist/gen-plan/lines.d.ts +31 -0
  190. package/dist/gen-plan/lines.js +183 -0
  191. package/dist/gen-plan/plots.d.ts +40 -0
  192. package/dist/gen-plan/plots.js +282 -0
  193. package/dist/gen-plan/route.d.ts +55 -0
  194. package/dist/gen-plan/route.js +297 -0
  195. package/dist/gen-plan/sites.d.ts +32 -0
  196. package/dist/gen-plan/sites.js +209 -0
  197. package/dist/gen-tex/code-stamp.d.ts +31 -0
  198. package/dist/gen-tex/code-stamp.js +137 -0
  199. package/dist/gen-tex/index.d.ts +7 -0
  200. package/dist/gen-tex/index.js +5 -0
  201. package/dist/gen-tex/light-horizon.d.ts +47 -0
  202. package/dist/gen-tex/light-horizon.js +180 -0
  203. package/dist/gen-tex/textures.d.ts +8 -0
  204. package/dist/gen-tex/textures.js +49 -0
  205. package/dist/gen-tex/value-textures.d.ts +46 -0
  206. package/dist/gen-tex/value-textures.js +102 -0
  207. package/dist/gen-vegetation/env-slots.d.ts +20 -0
  208. package/dist/gen-vegetation/env-slots.js +29 -0
  209. package/dist/gen-vegetation/index.d.ts +8 -0
  210. package/dist/gen-vegetation/index.js +7 -0
  211. package/dist/gen-vegetation/materials.d.ts +7 -0
  212. package/dist/gen-vegetation/materials.js +17 -0
  213. package/dist/gen-vegetation/planting.d.ts +170 -0
  214. package/dist/gen-vegetation/planting.js +363 -0
  215. package/dist/gen-vegetation/tree-shader.d.ts +23 -0
  216. package/dist/gen-vegetation/tree-shader.js +229 -0
  217. package/dist/gen-vegetation/trees.d.ts +59 -0
  218. package/dist/gen-vegetation/trees.js +329 -0
  219. package/dist/gpu/device.d.ts +286 -0
  220. package/dist/gpu/device.js +1157 -0
  221. package/dist/gpu/gl.d.ts +134 -0
  222. package/dist/gpu/gl.js +276 -0
  223. package/dist/gpu/index.d.ts +4 -0
  224. package/dist/gpu/index.js +3 -0
  225. package/dist/index.d.ts +11 -0
  226. package/dist/index.js +13 -0
  227. package/dist/motion/graph.d.ts +244 -0
  228. package/dist/motion/graph.js +739 -0
  229. package/dist/motion/index.d.ts +8 -0
  230. package/dist/motion/index.js +8 -0
  231. package/dist/motion/pose-ops.d.ts +30 -0
  232. package/dist/motion/pose-ops.js +232 -0
  233. package/dist/motion/reach.d.ts +45 -0
  234. package/dist/motion/reach.js +264 -0
  235. package/dist/motion/skeleton.d.ts +49 -0
  236. package/dist/motion/skeleton.js +99 -0
  237. package/dist/platform/byte-store.d.ts +21 -0
  238. package/dist/platform/byte-store.js +137 -0
  239. package/dist/platform/canvas.d.ts +29 -0
  240. package/dist/platform/canvas.js +76 -0
  241. package/dist/platform/context-loss.d.ts +8 -0
  242. package/dist/platform/context-loss.js +17 -0
  243. package/dist/platform/free-input.d.ts +51 -0
  244. package/dist/platform/free-input.js +100 -0
  245. package/dist/platform/index.d.ts +18 -0
  246. package/dist/platform/index.js +10 -0
  247. package/dist/platform/input.d.ts +48 -0
  248. package/dist/platform/input.js +117 -0
  249. package/dist/platform/keys.d.ts +12 -0
  250. package/dist/platform/keys.js +29 -0
  251. package/dist/platform/loop.d.ts +41 -0
  252. package/dist/platform/loop.js +84 -0
  253. package/dist/platform/walk-input.d.ts +74 -0
  254. package/dist/platform/walk-input.js +226 -0
  255. package/dist/platform/worker.d.ts +51 -0
  256. package/dist/platform/worker.js +170 -0
  257. package/dist/render/bone-instances.d.ts +24 -0
  258. package/dist/render/bone-instances.js +74 -0
  259. package/dist/render/cells.d.ts +70 -0
  260. package/dist/render/cells.js +144 -0
  261. package/dist/render/glsl.d.ts +66 -0
  262. package/dist/render/glsl.js +173 -0
  263. package/dist/render/index.d.ts +26 -0
  264. package/dist/render/index.js +16 -0
  265. package/dist/render/instance-sets.d.ts +97 -0
  266. package/dist/render/instance-sets.js +241 -0
  267. package/dist/render/near-instances.d.ts +75 -0
  268. package/dist/render/near-instances.js +219 -0
  269. package/dist/render/particles.d.ts +63 -0
  270. package/dist/render/particles.js +215 -0
  271. package/dist/render/pieces.d.ts +57 -0
  272. package/dist/render/pieces.js +151 -0
  273. package/dist/render/point-lights.d.ts +97 -0
  274. package/dist/render/point-lights.js +243 -0
  275. package/dist/render/renderer.d.ts +447 -0
  276. package/dist/render/renderer.js +1100 -0
  277. package/dist/render/rig.d.ts +74 -0
  278. package/dist/render/rig.js +576 -0
  279. package/dist/render/shadow-areas.d.ts +49 -0
  280. package/dist/render/shadow-areas.js +125 -0
  281. package/dist/render/shadow-glsl.d.ts +12 -0
  282. package/dist/render/shadow-glsl.js +146 -0
  283. package/dist/render/transient.d.ts +61 -0
  284. package/dist/render/transient.js +213 -0
  285. package/dist/render/value-glsl.d.ts +17 -0
  286. package/dist/render/value-glsl.js +208 -0
  287. package/dist/render/value-layers.d.ts +180 -0
  288. package/dist/render/value-layers.js +333 -0
  289. package/dist/runtime/atmosphere.d.ts +37 -0
  290. package/dist/runtime/atmosphere.js +304 -0
  291. package/dist/runtime/cloud-shell.d.ts +29 -0
  292. package/dist/runtime/cloud-shell.js +158 -0
  293. package/dist/runtime/engine.d.ts +155 -0
  294. package/dist/runtime/engine.js +305 -0
  295. package/dist/runtime/environment-link.d.ts +22 -0
  296. package/dist/runtime/environment-link.js +49 -0
  297. package/dist/runtime/index.d.ts +13 -0
  298. package/dist/runtime/index.js +12 -0
  299. package/dist/runtime/precipitation-glsl.d.ts +2 -0
  300. package/dist/runtime/precipitation-glsl.js +70 -0
  301. package/dist/runtime/precipitation.d.ts +11 -0
  302. package/dist/runtime/precipitation.js +78 -0
  303. package/dist/runtime/sky.d.ts +30 -0
  304. package/dist/runtime/sky.js +114 -0
  305. package/dist/runtime/streaming.d.ts +245 -0
  306. package/dist/runtime/streaming.js +602 -0
  307. package/dist/sim/agenda.d.ts +167 -0
  308. package/dist/sim/agenda.js +425 -0
  309. package/dist/sim/bytes.d.ts +34 -0
  310. package/dist/sim/bytes.js +125 -0
  311. package/dist/sim/destruction/apply.d.ts +59 -0
  312. package/dist/sim/destruction/apply.js +243 -0
  313. package/dist/sim/destruction/cell-states.d.ts +54 -0
  314. package/dist/sim/destruction/cell-states.js +198 -0
  315. package/dist/sim/destruction/index.d.ts +11 -0
  316. package/dist/sim/destruction/index.js +10 -0
  317. package/dist/sim/destruction/int-geometry.d.ts +17 -0
  318. package/dist/sim/destruction/int-geometry.js +131 -0
  319. package/dist/sim/destruction/pick.d.ts +13 -0
  320. package/dist/sim/destruction/pick.js +59 -0
  321. package/dist/sim/destruction/rubble.d.ts +8 -0
  322. package/dist/sim/destruction/rubble.js +159 -0
  323. package/dist/sim/destruction/state.d.ts +15 -0
  324. package/dist/sim/destruction/state.js +83 -0
  325. package/dist/sim/destruction/structure.d.ts +30 -0
  326. package/dist/sim/destruction/structure.js +139 -0
  327. package/dist/sim/events.d.ts +37 -0
  328. package/dist/sim/events.js +106 -0
  329. package/dist/sim/fixed.d.ts +21 -0
  330. package/dist/sim/fixed.js +64 -0
  331. package/dist/sim/flow-probe.d.ts +58 -0
  332. package/dist/sim/flow-probe.js +158 -0
  333. package/dist/sim/flow.d.ts +257 -0
  334. package/dist/sim/flow.js +967 -0
  335. package/dist/sim/index.d.ts +28 -0
  336. package/dist/sim/index.js +20 -0
  337. package/dist/sim/interlock.d.ts +47 -0
  338. package/dist/sim/interlock.js +252 -0
  339. package/dist/sim/movers.d.ts +228 -0
  340. package/dist/sim/movers.js +1083 -0
  341. package/dist/sim/nav.d.ts +72 -0
  342. package/dist/sim/nav.js +292 -0
  343. package/dist/sim/paths.d.ts +80 -0
  344. package/dist/sim/paths.js +197 -0
  345. package/dist/sim/regions.d.ts +87 -0
  346. package/dist/sim/regions.js +517 -0
  347. package/dist/sim/simulation.d.ts +114 -0
  348. package/dist/sim/simulation.js +291 -0
  349. package/dist/sim/states.d.ts +23 -0
  350. package/dist/sim/states.js +54 -0
  351. package/dist/sim/table.d.ts +49 -0
  352. package/dist/sim/table.js +126 -0
  353. package/dist/sim/zones.d.ts +11 -0
  354. package/dist/sim/zones.js +196 -0
  355. package/dist/tools/collision-lines.d.ts +12 -0
  356. package/dist/tools/collision-lines.js +50 -0
  357. package/dist/tools/data-view-glsl.d.ts +3 -0
  358. package/dist/tools/data-view-glsl.js +63 -0
  359. package/dist/tools/data-view-layers.d.ts +20 -0
  360. package/dist/tools/data-view-layers.js +60 -0
  361. package/dist/tools/debug-view.d.ts +30 -0
  362. package/dist/tools/debug-view.js +4 -0
  363. package/dist/tools/index.d.ts +10 -0
  364. package/dist/tools/index.js +7 -0
  365. package/dist/tools/mesh-checks.d.ts +67 -0
  366. package/dist/tools/mesh-checks.js +188 -0
  367. package/dist/tools/profile.d.ts +85 -0
  368. package/dist/tools/profile.js +173 -0
  369. package/dist/world/cell-cache.d.ts +32 -0
  370. package/dist/world/cell-cache.js +60 -0
  371. package/dist/world/cell-format.d.ts +25 -0
  372. package/dist/world/cell-format.js +232 -0
  373. package/dist/world/collide.d.ts +192 -0
  374. package/dist/world/collide.js +822 -0
  375. package/dist/world/index.d.ts +16 -0
  376. package/dist/world/index.js +12 -0
  377. package/dist/world/mesh-solids.d.ts +48 -0
  378. package/dist/world/mesh-solids.js +169 -0
  379. package/dist/world/pick.d.ts +34 -0
  380. package/dist/world/pick.js +177 -0
  381. package/dist/world/providers.d.ts +66 -0
  382. package/dist/world/providers.js +83 -0
  383. package/dist/world/sphere.d.ts +69 -0
  384. package/dist/world/sphere.js +271 -0
  385. package/dist/world/streaming.d.ts +288 -0
  386. package/dist/world/streaming.js +801 -0
  387. package/dist/world/walker.d.ts +145 -0
  388. package/dist/world/walker.js +502 -0
  389. package/docs/architecture.md +111 -0
  390. package/docs/cameras.md +302 -0
  391. package/docs/concepts.md +123 -0
  392. package/docs/destruction.md +127 -0
  393. package/docs/frames.md +199 -0
  394. package/docs/generators.md +575 -0
  395. package/docs/getting-started.md +123 -0
  396. package/docs/headless.md +50 -0
  397. package/docs/motion.md +160 -0
  398. package/docs/planet.md +152 -0
  399. package/docs/recipes.md +521 -0
  400. package/docs/reference.md +364 -0
  401. package/docs/rendering.md +823 -0
  402. package/docs/rigs.md +203 -0
  403. package/docs/simulation.md +235 -0
  404. package/docs/streaming.md +590 -0
  405. package/docs/system.md +166 -0
  406. package/docs/tools.md +175 -0
  407. package/docs/walking.md +262 -0
  408. package/package.json +131 -3
@@ -0,0 +1,320 @@
1
+ // Perspective camera rig that follows a moving point: a pivot above the followed point that trails it with a lag, and a
2
+ // boom from the pivot back to the eye, turned by a yaw around the vertical axis and a pitch above the horizon. A
3
+ // clearance callback (typically a collision world's sphere cast) shortens the boom at once where something stands
4
+ // between the pivot and the eye; the boom grows back smoothly. A boom of length 0 is the view from the pivot itself.
5
+ // Keys, pointer and gamepad are bound by `bindWalkInput` in platform. Implements `View` for the renderer.
6
+ //
7
+ // Flat world only: up is +y. A curved world would take the unit up at the pivot from an up source (as `FreeRig` does)
8
+ // in `update` and build the horizon of `axes` and `forward` from it; the places are marked "up:" below.
9
+ import { DEG, clamp, crossInto, dot, normalize, cross } from '../base/math.js';
10
+ export const DEFAULT_FOLLOW = {
11
+ fovDeg: 60,
12
+ near: 0.1,
13
+ far: 2000,
14
+ minDistance: 1,
15
+ maxDistance: 12,
16
+ minPitchDeg: -40,
17
+ maxPitchDeg: 80,
18
+ pivotHeight: 1.5,
19
+ followLag: 0.15,
20
+ boomReturn: 0.3,
21
+ turnPerPx: 0.004,
22
+ minFocus: 2,
23
+ };
24
+ /** Below this boom length (with `minDistance` 0) zooming in snaps to the view from the pivot. */
25
+ const SNAP_TO_PIVOT = 0.5;
26
+ export class FollowRig {
27
+ setup;
28
+ /** Heading in degrees; 0 looks toward −z, positive turns left. */
29
+ yawDeg = 0;
30
+ /** Pitch in degrees; positive looks down. Kept within the setup's limits by the methods, not on assignment. */
31
+ pitchDeg = 20;
32
+ /** Wanted boom length in metres; 0 is the view from the pivot. The drawn length is `boom`. */
33
+ distance = 4;
34
+ /** Shortens the boom; may be replaced at any time. */
35
+ clearance;
36
+ /** Canvas size in physical pixels and physical pixels per CSS pixel. */
37
+ width = 1;
38
+ height = 1;
39
+ dpr = 1;
40
+ /** The followed point as last given to `follow`. */
41
+ target = [0, 0, 0];
42
+ /** The smoothed pivot the boom turns around (followed point raised by `pivotHeight`, trailing it by `followLag`). */
43
+ pivot = [0, 0, 0];
44
+ /** The boom length drawn: `distance`, shortened by the clearance and growing back smoothly. */
45
+ _boom = 4;
46
+ /** False until the first `follow`: the pivot then jumps to the target instead of trailing it from the origin. */
47
+ placed = false;
48
+ scratch = { right: [0, 0, 0], up: [0, 0, 0], forward: [0, 0, 0] };
49
+ scratchVp = { right: [0, 0, 0], up: [0, 0, 0], forward: [0, 0, 0] };
50
+ scratchEye = [0, 0, 0];
51
+ /** The numbers the last `key` was made from (NaN: none yet) and that key. */
52
+ keyOf = new Float64Array(9).fill(NaN);
53
+ keyText = '';
54
+ constructor(setup = {}, options = {}) {
55
+ this.setup = { ...DEFAULT_FOLLOW, ...setup };
56
+ this.clearance = options.clearance ?? null;
57
+ this.distance = clamp(this.distance, this.setup.minDistance, this.setup.maxDistance);
58
+ this._boom = this.distance;
59
+ this.pitchDeg = clamp(this.pitchDeg, this.setup.minPitchDeg, this.setup.maxPitchDeg);
60
+ }
61
+ /** The boom length drawn this frame, metres. */
62
+ get boom() {
63
+ return this._boom;
64
+ }
65
+ /** Sets the followed point (the walker's render position). The first call places the pivot there at once. */
66
+ follow(x, y, z) {
67
+ const t = this.target;
68
+ t[0] = x;
69
+ t[1] = y;
70
+ t[2] = z;
71
+ if (!this.placed)
72
+ this.snap();
73
+ }
74
+ /** Puts the pivot on the followed point and the boom at its wanted length at once (after a jump, a cut). */
75
+ snap() {
76
+ this.placed = true;
77
+ const t = this.target;
78
+ // up: the pivot height would be laid along the local up.
79
+ this.pivot[0] = t[0];
80
+ this.pivot[1] = t[1] + this.setup.pivotHeight;
81
+ this.pivot[2] = t[2];
82
+ this._boom = this.reach(this.distance);
83
+ }
84
+ /** Smooths the pivot and shortens the boom by `clearance`; call once per frame with the real seconds since the last. */
85
+ update(dt) {
86
+ const s = this.setup;
87
+ const t = this.target;
88
+ const p = this.pivot;
89
+ const step = Math.max(0, dt);
90
+ // 1 − e^(−3 t / lag) closes 95 % of the gap in `lag` seconds, whatever the frame rate.
91
+ const k = s.followLag > 0 ? 1 - Math.exp((-3 * step) / s.followLag) : 1;
92
+ // up: the pivot height would be laid along the local up.
93
+ p[0] += (t[0] - p[0]) * k;
94
+ p[1] += (t[1] + s.pivotHeight - p[1]) * k;
95
+ p[2] += (t[2] - p[2]) * k;
96
+ const want = this.reach(this.distance);
97
+ if (want <= this._boom)
98
+ this._boom = want;
99
+ else {
100
+ const g = s.boomReturn > 0 ? 1 - Math.exp((-3 * step) / s.boomReturn) : 1;
101
+ this._boom += (want - this._boom) * g;
102
+ // Close enough is there: the key, and with it a still image, settles.
103
+ if (want - this._boom < 1e-4)
104
+ this._boom = want;
105
+ }
106
+ }
107
+ /** The length a boom of `wanted` metres may have now: the clearance along the boom's direction from the pivot. */
108
+ reach(wanted) {
109
+ if (wanted <= 0)
110
+ return 0;
111
+ if (!this.clearance)
112
+ return wanted;
113
+ const f = this.axes(this.scratch).forward;
114
+ const p = this.pivot;
115
+ // The boom runs from the pivot against the view direction.
116
+ const r = this.clearance(p[0], p[1], p[2], -f[0], -f[1], -f[2], wanted);
117
+ return Number.isFinite(r) ? clamp(r, 0, wanted) : wanted;
118
+ }
119
+ /** Turns by pointer movement in physical pixels: right turns the view right, down turns it down. */
120
+ turnPixels(dx, dy) {
121
+ const k = this.setup.turnPerPx / this.dpr / DEG;
122
+ this.yawDeg -= dx * k;
123
+ // Keep the heading within ±180° so the key stays short and comparable.
124
+ if (this.yawDeg > 180)
125
+ this.yawDeg -= 360;
126
+ else if (this.yawDeg < -180)
127
+ this.yawDeg += 360;
128
+ this.pitchDeg = clamp(this.pitchDeg + dy * k, this.setup.minPitchDeg, this.setup.maxPitchDeg);
129
+ }
130
+ /**
131
+ * Multiplies the wanted boom length (below 1 comes closer), within `minDistance` … `maxDistance`. With
132
+ * `minDistance` 0 a boom shorter than half a metre becomes 0, the view from the pivot; zooming out from 0 starts at
133
+ * `max(minDistance, 0.5)`.
134
+ */
135
+ zoomBy(factor) {
136
+ const s = this.setup;
137
+ if (this.distance <= 0) {
138
+ if (factor > 1)
139
+ this.distance = Math.max(s.minDistance, SNAP_TO_PIVOT);
140
+ return;
141
+ }
142
+ let d = clamp(this.distance * factor, s.minDistance, s.maxDistance);
143
+ if (s.minDistance <= 0 && d < SNAP_TO_PIVOT && factor < 1)
144
+ d = 0;
145
+ this.distance = d;
146
+ }
147
+ /** Unit direction on the ground plane the view looks along, for turning input into world movement. Written to `out`. */
148
+ forward(out) {
149
+ const yaw = this.yawDeg * DEG;
150
+ // up: on a curved world this is the heading laid into the local horizon.
151
+ out[0] = -Math.sin(yaw);
152
+ out[1] = 0;
153
+ out[2] = -Math.cos(yaw);
154
+ return out;
155
+ }
156
+ /** View: rotation around the vertical axis in radians. */
157
+ get heading() {
158
+ return this.yawDeg * DEG;
159
+ }
160
+ get tanHalfY() {
161
+ return Math.tan((this.setup.fovDeg * DEG) / 2);
162
+ }
163
+ /** Distance in front of the eye that counts as the centre of the view: the pivot, or `minFocus` when closer. */
164
+ get focus() {
165
+ return Math.max(this._boom, this.setup.minFocus);
166
+ }
167
+ /** View: pixel size at the centre of the view. */
168
+ get metresPerPixel() {
169
+ return this.focus * this.pixelGrowth;
170
+ }
171
+ /** View: metres per pixel gained per metre of depth. */
172
+ get pixelGrowth() {
173
+ return (2 * this.tanHalfY) / this.height;
174
+ }
175
+ /** View: depth of the centre of the view along the view direction. */
176
+ get refDepth() {
177
+ const f = this.axes(this.scratch).forward;
178
+ return dot(f, this.eye(this.scratchEye)) + this.focus;
179
+ }
180
+ /** View: screen right, screen up and the view direction. With `out` its arrays are written and `out` is returned. */
181
+ axes(out) {
182
+ const yaw = this.yawDeg * DEG;
183
+ const p = this.pitchDeg * DEG;
184
+ const f = out ?? { right: [0, 0, 0], up: [0, 0, 0], forward: [0, 0, 0] };
185
+ // up: the horizon here is the plane normal to +y.
186
+ f.right[0] = Math.cos(yaw);
187
+ f.right[1] = 0;
188
+ f.right[2] = -Math.sin(yaw);
189
+ f.forward[0] = -Math.sin(yaw) * Math.cos(p);
190
+ f.forward[1] = -Math.sin(p);
191
+ f.forward[2] = -Math.cos(yaw) * Math.cos(p);
192
+ crossInto(f.right, f.forward, f.up);
193
+ return f;
194
+ }
195
+ /** The eye: the pivot moved back along the view direction by the drawn boom. With `out` it is written there. */
196
+ eye(out) {
197
+ const f = this.axes(this.scratch).forward;
198
+ const p = this.pivot;
199
+ const b = this._boom;
200
+ const e = out ?? [0, 0, 0];
201
+ e[0] = p[0] - f[0] * b;
202
+ e[1] = p[1] - f[1] * b;
203
+ e[2] = p[2] - f[2] * b;
204
+ return e;
205
+ }
206
+ /**
207
+ * World → clip matrix. The near and far planes are the setup's, pulled in to the sphere of `depthHalfRange` around
208
+ * `sceneCenter` where it is smaller (never pushed out).
209
+ */
210
+ viewProj(sceneCenter, depthHalfRange, out) {
211
+ const { right: r, up: u, forward: w } = this.axes(this.scratchVp);
212
+ const eye = this.eye(this.scratchEye);
213
+ const s = this.setup;
214
+ const dc = dot(w, sceneCenter) - dot(w, eye);
215
+ const near = Math.max(s.near, dc - depthHalfRange);
216
+ const far = Math.max(Math.min(s.far, dc + depthHalfRange), near * 2);
217
+ const fy = 1 / this.tanHalfY;
218
+ const fx = fy / (this.width / this.height);
219
+ const a = (far + near) / (far - near);
220
+ const b = (-2 * far * near) / (far - near);
221
+ const m = out ?? new Float32Array(16);
222
+ m.fill(0);
223
+ const re = dot(r, eye);
224
+ const ue = dot(u, eye);
225
+ const we = dot(w, eye);
226
+ for (let i = 0; i < 3; i++) {
227
+ m[i * 4 + 0] = fx * r[i];
228
+ m[i * 4 + 1] = fy * u[i];
229
+ m[i * 4 + 2] = a * w[i];
230
+ m[i * 4 + 3] = w[i];
231
+ }
232
+ m[12] = -fx * re;
233
+ m[13] = -fy * ue;
234
+ m[14] = -a * we + b;
235
+ m[15] = -we;
236
+ return m;
237
+ }
238
+ /** Direction through a point in normalised screen coordinates (−1…1, y up) for the axes `ax`, written into `out`. */
239
+ dirInto(sx, sy, ax, out) {
240
+ const { right, up, forward } = ax;
241
+ const ty = this.tanHalfY;
242
+ const tx = ty * (this.width / this.height);
243
+ const x = forward[0] + right[0] * sx * tx + up[0] * sy * ty;
244
+ const y = forward[1] + right[1] * sx * tx + up[1] * sy * ty;
245
+ const z = forward[2] + right[2] * sx * tx + up[2] * sy * ty;
246
+ const l = Math.hypot(x, y, z) || 1;
247
+ out[0] = x / l;
248
+ out[1] = y / l;
249
+ out[2] = z / l;
250
+ return out;
251
+ }
252
+ /**
253
+ * View: rays from the eye through the image corners (left-bottom, left-top, right-bottom, right-top). With `out`
254
+ * (see `newCornerRays`) each ray's own arrays are written and `out` is returned.
255
+ */
256
+ cornerRays(out) {
257
+ const ax = this.axes(this.scratchVp);
258
+ if (!out) {
259
+ const eye = this.eye();
260
+ const rays = [];
261
+ for (let i = 0; i < 4; i++)
262
+ rays.push({ origin: eye, dir: this.dirInto(i < 2 ? -1 : 1, i % 2 === 0 ? -1 : 1, ax, [0, 0, 0]) });
263
+ return rays;
264
+ }
265
+ for (let i = 0; i < 4; i++) {
266
+ const r = out[i];
267
+ this.eye(r.origin);
268
+ this.dirInto(i < 2 ? -1 : 1, i % 2 === 0 ? -1 : 1, ax, r.dir);
269
+ }
270
+ return out;
271
+ }
272
+ /** View: the four side planes through the eye and the plane of the eye itself, normals inward. */
273
+ cullVolume() {
274
+ const eye = this.eye();
275
+ const ax = this.axes();
276
+ const forward = ax.forward;
277
+ const d = [this.dirInto(-1, -1, ax, [0, 0, 0]), this.dirInto(-1, 1, ax, [0, 0, 0]), this.dirInto(1, 1, ax, [0, 0, 0]), this.dirInto(1, -1, ax, [0, 0, 0])];
278
+ const planes = [[forward[0], forward[1], forward[2], -dot(forward, eye)]];
279
+ for (let i = 0; i < 4; i++) {
280
+ let n = normalize(cross(d[i], d[(i + 1) % 4]));
281
+ if (dot(n, forward) < 0)
282
+ n = [-n[0], -n[1], -n[2]];
283
+ planes.push([n[0], n[1], n[2], -dot(n, eye)]);
284
+ }
285
+ return { kind: 'frustum', planes };
286
+ }
287
+ /** View: changes whenever the image of a static scene would. */
288
+ key() {
289
+ const p = this.pivot;
290
+ // The string is made again only when a number in it changed, so a still view allocates nothing.
291
+ const k = this.keyOf;
292
+ if (k[0] === p[0] && k[1] === p[1] && k[2] === p[2] && k[3] === this.yawDeg && k[4] === this.pitchDeg && k[5] === this._boom && k[6] === this.width && k[7] === this.height && k[8] === this.setup.fovDeg)
293
+ return this.keyText;
294
+ k[0] = p[0];
295
+ k[1] = p[1];
296
+ k[2] = p[2];
297
+ k[3] = this.yawDeg;
298
+ k[4] = this.pitchDeg;
299
+ k[5] = this._boom;
300
+ k[6] = this.width;
301
+ k[7] = this.height;
302
+ k[8] = this.setup.fovDeg;
303
+ this.keyText = `follow|${p[0].toFixed(3)},${p[1].toFixed(3)},${p[2].toFixed(3)}|${this.yawDeg.toFixed(4)}|${this.pitchDeg.toFixed(4)}|${this._boom.toFixed(3)}|${this.setup.fovDeg}|${this.width}x${this.height}`;
304
+ return this.keyText;
305
+ }
306
+ /** Ray under a screen point in physical pixels from the top-left corner. */
307
+ screenRay(px, py) {
308
+ return { origin: this.eye(), dir: this.dirInto((2 * px) / this.width - 1, 1 - (2 * py) / this.height, this.axes(), [0, 0, 0]) };
309
+ }
310
+ /** Where a world point lands on the canvas, in physical pixels from the top-left corner. */
311
+ project(p) {
312
+ const { right, up, forward } = this.axes();
313
+ const e = this.eye();
314
+ const v = [p[0] - e[0], p[1] - e[1], p[2] - e[2]];
315
+ const z = dot(forward, v);
316
+ const ty = this.tanHalfY;
317
+ const tx = ty * (this.width / this.height);
318
+ return [((dot(right, v) / (z * tx) + 1) * this.width) / 2, ((1 - dot(up, v) / (z * ty)) * this.height) / 2];
319
+ }
320
+ }
@@ -0,0 +1,153 @@
1
+ import type { OrthoFrame, Vec3 } from '../base/math.ts';
2
+ import type { CullFrustum, Ray, View } from '../base/view.ts';
3
+ import type { WorldPos, WorldShape } from '../gen-core/index.ts';
4
+ /** The part of a world shape the rig reads: the unit up direction at a world position. */
5
+ export type UpSource = Pick<WorldShape, 'upAt'>;
6
+ /** Height of a world position above the surface under it, measured along the local up, in metres. */
7
+ export type HeightAbove = (p: WorldPos) => number;
8
+ export interface FreeSetup {
9
+ /** Vertical field of view in degrees. */
10
+ fovYDeg: number;
11
+ /** Limit of the pitch on both sides of the horizon, in degrees (at most 90). */
12
+ maxPitchDeg: number;
13
+ /** Radians of turn per CSS pixel of pointer movement. */
14
+ turnPerPx: number;
15
+ /** Height above the surface the rig never goes below, in metres. Needs a height callback. */
16
+ minClearance: number;
17
+ /**
18
+ * `true`: a move keeps the height above the surface, so the rig follows the surface up and down and only the part of
19
+ * a move along the local up changes that height. `false`: the rig keeps its course and only `minClearance` holds it
20
+ * off the surface. Needs a height callback.
21
+ */
22
+ followSurface: boolean;
23
+ /** Cruise speed gained per metre of height above the surface (1 crosses its own height every second). */
24
+ speedPerHeight: number;
25
+ /** Limits of the cruise speed in metres per second. Without a height callback the rig cruises at `minSpeed`. */
26
+ minSpeed: number;
27
+ maxSpeed: number;
28
+ /** Speed factor while the boost is held. */
29
+ boost: number;
30
+ /** Time constant in seconds with which the velocity follows the input; 0 follows it at once. */
31
+ inertiaS: number;
32
+ /** `true`: "forward" moves along the horizon whatever the pitch. `false`: it moves along the view direction. */
33
+ levelMove: boolean;
34
+ /** Largest ratio of the far to the near plane. The near plane sits at far / depthRatio unless the surface is closer. */
35
+ depthRatio: number;
36
+ /** The near plane is never farther than this fraction of the height above the surface (when it is known). */
37
+ nearPerHeight: number;
38
+ /** Smallest distance of the near plane in metres. */
39
+ minNear: number;
40
+ }
41
+ export declare const DEFAULT_FREE: FreeSetup;
42
+ export interface FreeOptions {
43
+ /** Where up is. The default is +y everywhere, as on a flat world. */
44
+ shape?: UpSource;
45
+ /** Height above the surface. Without it the rig neither keeps a clearance nor scales its speed. */
46
+ heightAbove?: HeightAbove;
47
+ }
48
+ export interface FreeState {
49
+ /** World position in metres. */
50
+ position: Vec3;
51
+ /** Heading in degrees, measured in the local horizon from the world −z axis; positive turns left. */
52
+ yawDeg: number;
53
+ /** Pitch in degrees; positive looks below the horizon. */
54
+ pitchDeg: number;
55
+ }
56
+ export declare class FreeRig implements View {
57
+ readonly setup: FreeSetup;
58
+ /** World position of the eye in metres. After writing it directly call `keepClear()`. */
59
+ position: Vec3;
60
+ /**
61
+ * World position the renderer's space starts at. Every position the `View` contract hands out (`eye`, rays, the
62
+ * cull volume, the matrix) is relative to it. Keep it near the eye and equal to the origin the layers are drawn with.
63
+ */
64
+ origin: Vec3;
65
+ /** Pitch in radians; positive looks below the horizon. */
66
+ pitch: number;
67
+ /** Multiplier of the cruise speed the user controls (see `scaleSpeed`). */
68
+ speedScale: number;
69
+ /** World velocity in metres per second after the last `move`. */
70
+ velocity: Vec3;
71
+ /** Height above the surface at the last `keepClear`, NaN without a height callback. */
72
+ clearance: number;
73
+ /** Distance in front of the eye that counts as the centre of the view (`metresPerPixel`, `refDepth`). */
74
+ focusDistance: number;
75
+ /** Height above the surface, or null. May be replaced at any time. */
76
+ heightAbove: HeightAbove | null;
77
+ /** Canvas size in physical pixels and physical pixels per CSS pixel. */
78
+ width: number;
79
+ height: number;
80
+ dpr: number;
81
+ private readonly shape;
82
+ /** Unit heading in the local horizon. */
83
+ private tangent;
84
+ constructor(setup?: Partial<FreeSetup>, options?: FreeOptions, state?: Partial<FreeState>);
85
+ /** Jumps to a state: the velocity is dropped on a new position and the clearance is applied. */
86
+ setState(s: Partial<FreeState>): void;
87
+ state(): FreeState;
88
+ private clampPitch;
89
+ /**
90
+ * Unit up at the position. The position may have moved to a place with another up since the heading was stored, so
91
+ * this also lays the heading back into the horizon (the same heading, carried along).
92
+ */
93
+ up(): Vec3;
94
+ /** Unit direction of the heading in the local horizon (the view direction without its pitch). */
95
+ headingDir(): Vec3;
96
+ /** Heading in radians, measured in the local horizon from the world −z axis; positive turns left. */
97
+ get yaw(): number;
98
+ set yaw(a: number);
99
+ /** View: rotation around the local up in radians. */
100
+ get heading(): number;
101
+ private get tanHalfY();
102
+ /** View: pixel size at `focusDistance` in front of the eye. */
103
+ get metresPerPixel(): number;
104
+ /** View: metres per pixel gained per metre of depth. */
105
+ get pixelGrowth(): number;
106
+ /** View: depth of the point `focusDistance` in front of the eye, in the renderer's space. */
107
+ get refDepth(): number;
108
+ /** Screen right, screen up and the view direction, built from the local up, the heading and the pitch. */
109
+ axes(): OrthoFrame;
110
+ /** The eye in the renderer's space: the world position minus `origin`, subtracted in double precision. With `out` it is written there. */
111
+ eye(out?: Vec3): Vec3;
112
+ /**
113
+ * World → clip matrix (the world here is the renderer's space). The far plane encloses the sphere of
114
+ * `depthHalfRange` around `sceneCenter`. The near plane sits at far / `depthRatio`, but no farther than
115
+ * `nearPerHeight` of the height above the surface, so that the surface under a low eye is not cut away.
116
+ */
117
+ viewProj(sceneCenter: Vec3, depthHalfRange: number): Float32Array;
118
+ /** Direction through a point given in normalised screen coordinates (−1…1, y up). */
119
+ private dirAt;
120
+ /** View: rays from the eye through the image corners (left-bottom, left-top, right-bottom, right-top). */
121
+ cornerRays(): Ray[];
122
+ /** View: the four side planes through the eye and the plane of the eye itself, normals inward. */
123
+ cullVolume(): CullFrustum;
124
+ /** View: changes whenever the image of a static scene would. */
125
+ key(): string;
126
+ /** Ray under a screen point in physical pixels from the top-left corner, in the renderer's space. */
127
+ screenRay(px: number, py: number): Ray;
128
+ /** Where a point of the renderer's space lands on the canvas, in physical pixels from the top-left corner. */
129
+ project(p: Vec3): [number, number];
130
+ /** Turns by angles in radians: the heading around the local up (positive turns left), the pitch (positive looks down). */
131
+ turn(yawDelta: number, pitchDelta: number): void;
132
+ /** Turns by pointer movement in physical pixels: right turns the view right, down turns it down. */
133
+ turnPixels(dx: number, dy: number): void;
134
+ /** Turns the view toward a world position. */
135
+ lookAt(target: WorldPos): void;
136
+ /** Cruise speed in metres per second at the current height, before the boost. */
137
+ get speed(): number;
138
+ /** Multiplies the user's speed multiplier, kept within 1/64 … 64. */
139
+ scaleSpeed(factor: number): void;
140
+ /**
141
+ * Moves for `dt` seconds. The inputs are −1…1: `forward` along the view direction (along the horizon with
142
+ * `levelMove`), `right` along screen right, `up` along the local up. The velocity follows the input with the
143
+ * inertia of the setup. Returns whether the rig is still moving, so the caller knows to draw another frame.
144
+ */
145
+ move(forward: number, right: number, up: number, dt: number, boost?: boolean): boolean;
146
+ /**
147
+ * Reads the height above the surface and, where it is below `minClearance`, lifts the position along the local up.
148
+ * `move` and `setState` call it; call it yourself after writing `position` or when the surface changed.
149
+ */
150
+ keepClear(): void;
151
+ /** Moves the position along the local up to the height `hold` above the surface, or only up to `minClearance`. */
152
+ private settle;
153
+ }