recast-runtime-only
v0.43.1
Published
Runtime-only WebAssembly build of Recast Navigation
Readme
@recast-navigation/wasm-runtime-only
Runtime-only WebAssembly build of Recast Navigation. This package contains only the Detour NavMesh query and Crowd runtime; it does not contain Recast generation, TileCache, ChunkyTriMesh, serialization helpers, or DebugDraw.
Install it in a Cocos Creator project. This package is separate from the full
@recast-navigation/wasm package, so npm downloads only the runtime-only files:
npm install @recast-navigation/wasm-runtime-onlyUse the embedded-WASM entry by default:
import createRecastRuntime from '@recast-navigation/wasm-runtime-only';
const Module = await createRecastRuntime();The split entry is available when the .wasm file must be served separately:
import createRecastRuntime from '@recast-navigation/wasm-runtime-only/wasm';
const Module = await createRecastRuntime({
locateFile: (fileName: string) => `/assets/navigation/${fileName}`,
});The package is built from packages/recast-navigation-wasm with
yarn build:runtime-only and only copies the four runtime-only artifacts into
this package's dist/ directory.
For Cocos Creator, the package also provides
cocos/RuntimeOnlyWasmAssetLoader.ts. It uses BufferAsset.buffer() and the
generated Emscripten instantiateWasm hook, so the .wasm binary is loaded by
Cocos instead of fetched by the glue code.
