Koto scripting for fidget (as alternative to Rhai)
fidget-viewer https://github.com/mkeeter/fidget/tree/main/demos/viewer modified to accept Koto scripts.
cargo run --release -p fidget-viewer PATH_TO_YOUR_KOTO_SCRIPT_MODELThe models folder has some examples (all Rhai fidget models have been ported to Koto and some new ones added). The fidget-viewer can currently only watch one Koto file, therefore any attempt to import from a differnt module represented by a differnt Koto file in the models folder will fail.
- no
draw_rgb()function, just usedraw()with optionally adding the color argumentsr,gandb. - use
tree()Koto shape method for converting to a fidget Tree. - Engine initialization
- Default:
Engine::default() - Custom:
Engine::new(settings: EngineSettings). The following options are available:add_fidget_fns: boolfor making allfidgethelper functions avaliable at top levelexecution_limit: Durationfor scripting execution time limit
- Default:
Either use the built-in implementation from the core library:
# sphere with radius=1.0, x=0.0 (default), y=0.0 (default), z=0.0 (default)
draw sphere 1
or build it from scratch by using fidget Tree operations as with Rhai:
draw (x.square() + y.square() + z.square()).sqrt() - 1
or with operators where possible:
draw (x^2 + y^2 + z^2)).sqrt() - 1
or from scratch, but with importing fidget Tree operations into global namespace:
from fidget import square, sqrt
draw sqrt(square(x) + square(y) + square(z)) - 1