examples/react/generate-motion
| Name | Last commit message | Last commit date |
|---|---|---|
| .. | ||
README.md
Generate Motion#
You need animation clips for a game ability. This app makes two clips for an orc "Leap Slam": the orc attack and the enemy reaction. Then it shows the ability manifest that your game imports.
Run it#
- From the repo root, run
pnpm install. - Run
pnpm --filter generate-motion dev. - Open http://localhost:3100.
- Paste a fal key from https://fal.ai/dashboard/keys. You can also set
FAL_KEYin.env.local. - Click Generate on each clip. When both clips are done, the manifest shows.
The key stays in this tab only. A reload clears it.
What you get#
- Each clip is an FBX file from fal Hunyuan Motion (
fal-ai/hunyuan-motion). - The clip uses an SMPL-H skeleton (52 bones, root bone
Pelvis) at 30 fps. Root motion is in thePelvisbone. Retarget the clip to your rig in your engine. scripts/generate-orc-clips.tsmakes the six orc clips in one run:FAL_KEY=... node scripts/generate-orc-clips.ts. The files go tooutput/orc-axe/, which git ignores.- fal file links expire. Download each file and store it with your game assets.
Stop and cancel#
- Stop watching closes the stream in this tab. The fal job keeps running.
- Cancel on fal asks fal to stop the job. A job that already runs can still finish.
Files#
src/routes/api.generate.motion.ts: submits the job and streams its status.src/routes/api.motion.cancel.ts: cancels a job on fal.src/routes/index.tsx: the two clips and the manifest.