Quickstart¶
This page gets you from zero to a running simulation in about two minutes.
1. Install¶
2. Write a build script¶
Create hello_world.py:
import mujoco
import mjswan
builder = mjswan.Builder()
project = builder.add_project(name="Hello World")
spec = mujoco.MjSpec.from_string("""
<mujoco>
<worldbody>
<light diffuse=".5 .5 .5" pos="0 0 3" dir="0 0 -1"/>
<geom type="plane" size="1 1 0.1" rgba=".9 0 0 1"/>
<body pos="0 0 1">
<joint type="free"/>
<geom type="box" size=".1 .2 .3" rgba="0 .9 0 1"/>
</body>
</worldbody>
</mujoco>
""")
project.add_scene(spec=spec, name="Falling Box")
app = builder.build()
app.launch()
3. Run it¶
mjswan will:
- Build the application into a
dist/directory next to your script - Start a local web server on
http://localhost:8080 - Open the URL in your default browser
You should see an interactive 3D view of a green box falling onto a red plane. Click and drag to orbit the camera. Press Ctrl-C in the terminal to stop the server.
Next steps¶
- Core Concepts — understand the Builder → Project → Scene → Policy hierarchy
- Examples — copy-paste patterns for policies, multiple projects, and more
- CLI — the
mjswancommand:view,serve,new,demo,info - Deployment — host your app on GitHub Pages or Netlify