Skip to content
Konjure / spatial intelligence
Browse docs

Your first Konjure scene

Make a sphere and ring, change one value, and inspect the result.

Start with Language basics and Types and traits if you are new to the syntax.

This program is the first-scene.kj starter from crates/konjure-lang. It makes a grid, a cyan sphere and an amber torus with checked Mesh methods. Every construction returns Res[Mesh, DataError], so ? stops an invalid shape before it becomes a scene.

More
Tick 0 · 0.00 s
main.kj⌘ / Ctrl + Enter
Loading…Drag to orbit · select to inspect
0 entities
Results
Loading the language runtime…
Output 0
No output.

Run it

Press Run. The preview shows the three meshes; the Debug and Trace tabs show the runtime world and source locations. Drag the scene to orbit, then select an object to inspect its geometry.

Use Run to restart from your edited source and Reset to restore the starter. Play and Step matter when you add a system; the lifecycle example shows its init, frame and done callbacks.

Change one value

Change the sphere’s x: 0.6 position, compile again, and see it move. Then change its radius or the torus’s major radius. If an edit fails to compile or a mesh argument is invalid, the workbench reports a diagnostic and preserves the last accepted program until a new compile succeeds.

Try changing the sphere’s segment count to 2. The mesh constructor returns a checked error because the resolution is too small. Restore 16, then compile again.

Run the same source from Rust

From the repository root, the language CLI runs the crate-owned file directly:

Sourcesh
cargo run -p konjure-tools --bin kj-lang -- run crates/konjure-lang/examples/kreate/first-scene.kj --ticks 60

The workbench and CLI use the same Rust language implementation, distributed to the browser through WebAssembly. Continue with the language guide for types, traits, modules, systems, and current limits.