Gen Experimental Frame Editor
Experimental frame/skeleton editor for procedural body animation and inverse kinematics.
Experimental frame/skeleton editor for procedural body animation and inverse kinematics.
Overview
The exp_frame module is an experimental tool within the gen editor framework for creating and manipulating skeletal body structures. It implements a bone/joint system with gradient-descent optimization for inverse kinematics, supporting femur, tibia, pelvic, and sternum bones with configurable lengths and angles.
Module Table: W
| Field | Type | Description |
|---|---|---|
W.out | table | Output data |
W.ui | table | UI state |
W.isactive | boolean | Whether the editor is active |
Key Functions
| Function | Description |
|---|---|
W.up(k, lbl) | Initializes the editor: hides player, registers window, creates edit group |
a2b(ac, g) | Applies coefficient array to body bone angles |
forEdge(nm) | Computes edge vector for a named bone |
Body Structure
| Bone | From → To | Length | Description |
|---|---|---|---|
tibia_r | t_b_r → f_b_r | 0.6 | Right tibia |
tibia_l | t_b_l → f_b_l | 0.6 | Left tibia |
femur_r | f_b_r → p_r | 0.6 | Right femur |
femur_l | f_b_l → p_l | 0.6 | Left femur |
pelvic | p_r → p_l | 0.4 | Pelvic bone |
sternum | s_b → s_t | 0.8 | Sternum |
Dependencies
| Module | Path |
|---|---|
| Utils | /lua/ge/extensions/editor/gen/utils |
| UI Lib | /lua/ge/extensions/editor/gen/lib/ui |
| AI Lib | /lua/ge/extensions/editor/gen/lib/ai |
Usage Example
-- The frame editor is activated through the gen editor menu.
-- It creates a SimGroup 'edit' for its objects and uses
-- gradient descent to solve IK for the skeleton.
W.up('exp_frame', 'Frame Editor')Exported Fields
W.dmove(table) - Movement definitions table containingto_targetandstopmovement modes with callbacks and target positions.W.isactive(boolean) - Whether the editor is currently active.
Exported Functions
W.up(k, lbl)
Initializes the frame editor: hides spawn/player objects, registers and shows editor window, creates edit SimGroup, runs test in dev mode.
k(string) - Window name/keylbl(string) - Window label
W.onVal(key, val)
Callback for UI value changes. Handles coefficient display switching via key index.
key(number) - Coefficient indexval(any) - Value
W.gui()
Renders the ImGui editor window with bone coefficients, gradients, loss values, and hint overlay.
W.update()
Per-frame update: runs gradient descent optimization steps, handles mouse click (set target) and keyboard input (step/pause/dump).
W.test()
Initializes test scenario: loads saved state from file, sets up movement target, runs initial optimization pass.
See Also
- Gen AI Library - Gradient descent optimization
- Gen Mesh - 3D mesh utilities
- Gen SolidFlex - Solid/flex body simulation